From b25feb221ae24488bac469013bdc183fbf7b70c8 Mon Sep 17 00:00:00 2001 From: Niels Andriesse Date: Wed, 14 Jul 2021 14:17:40 +1000 Subject: [PATCH] Add FAQ button to settings --- .../securesms/preferences/SettingsActivity.kt | 22 ++++++++++++++----- app/src/main/res/layout/activity_settings.xml | 11 ++++++++++ app/src/main/res/values/strings.xml | 1 + 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt index e8c3674736..a016486a59 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/SettingsActivity.kt @@ -84,6 +84,7 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { notificationsButton.setOnClickListener { showNotificationSettings() } chatsButton.setOnClickListener { showChatSettings() } sendInvitationButton.setOnClickListener { sendInvitation() } + faqButton.setOnClickListener { showFAQ() } helpTranslateButton.setOnClickListener { helpTranslate() } seedButton.setOnClickListener { showSeed() } clearAllDataButton.setOnClickListener { clearAllData() } @@ -224,7 +225,6 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { Toast.makeText(this, R.string.activity_settings_display_name_too_long_error, Toast.LENGTH_SHORT).show() return false } -// isEditingDisplayName = false displayNameToBeUploaded = displayName updateProfile(false) return true @@ -238,11 +238,11 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { private fun showEditProfilePictureUI() { // Ask for an optional camera permission. Permissions.with(this) - .request(Manifest.permission.CAMERA) - .onAnyResult { - tempFile = AvatarSelection.startAvatarSelection(this, false, true) - } - .execute() + .request(Manifest.permission.CAMERA) + .onAnyResult { + tempFile = AvatarSelection.startAvatarSelection(this, false, true) + } + .execute() } private fun copyPublicKey() { @@ -286,6 +286,16 @@ class SettingsActivity : PassphraseRequiredActionBarActivity() { startActivity(chooser) } + private fun showFAQ() { + try { + val url = "https://getsession.org/faq" + val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url)) + startActivity(intent) + } catch (e: Exception) { + Toast.makeText(this, "Can't open URL", Toast.LENGTH_LONG).show() + } + } + private fun helpTranslate() { try { val url = "https://crowdin.com/project/session-android" diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index f562538791..0e8bf779ff 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -202,6 +202,17 @@ android:gravity="center" android:text="@string/activity_settings_invite_button_title" /> + + Chats Devices Invite + FAQ Recovery Phrase Clear Data Clear Data Including Network