Add a help section in the settings.

This commit is contained in:
Benoit Marty 2021-12-08 23:15:57 +01:00 committed by Benoit Marty
parent 17c4c1e9b8
commit 7f7199abd4
6 changed files with 54 additions and 16 deletions

1
changelog.d/4638.feature Normal file
View File

@ -0,0 +1 @@
Add a help section in the settings.

View File

@ -35,6 +35,7 @@ import javax.inject.Inject
class VectorPreferences @Inject constructor(private val context: Context) {
companion object {
const val SETTINGS_HELP_PREFERENCE_KEY = "SETTINGS_HELP_PREFERENCE_KEY"
const val SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY = "SETTINGS_CHANGE_PASSWORD_PREFERENCE_KEY"
const val SETTINGS_VERSION_PREFERENCE_KEY = "SETTINGS_VERSION_PREFERENCE_KEY"
const val SETTINGS_SDK_VERSION_PREFERENCE_KEY = "SETTINGS_SDK_VERSION_PREFERENCE_KEY"

View File

@ -20,8 +20,10 @@ import androidx.preference.Preference
import im.vector.app.BuildConfig
import im.vector.app.R
import im.vector.app.core.preference.VectorPreference
import im.vector.app.core.utils.FirstThrottler
import im.vector.app.core.utils.copyToClipboard
import im.vector.app.core.utils.openAppSettingsPage
import im.vector.app.core.utils.openUrlInChromeCustomTab
import im.vector.app.features.version.VersionProvider
import org.matrix.android.sdk.api.Matrix
import javax.inject.Inject
@ -33,7 +35,18 @@ class VectorSettingsHelpAboutFragment @Inject constructor(
override var titleRes = R.string.preference_root_help_about
override val preferenceXmlRes = R.xml.vector_settings_help_about
private val firstThrottler = FirstThrottler(1000)
override fun bindPref() {
// Help
findPreference<VectorPreference>(VectorPreferences.SETTINGS_HELP_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {
if (firstThrottler.canHandle() is FirstThrottler.CanHandlerResult.Yes) {
openUrlInChromeCustomTab(requireContext(), null, VectorSettingsUrls.HELP)
}
false
}
// preference to start the App info screen, to facilitate App permissions access
findPreference<VectorPreference>(APP_INFO_LINK_PREFERENCE_KEY)!!
.onPreferenceClickListener = Preference.OnPreferenceClickListener {

View File

@ -17,6 +17,7 @@
package im.vector.app.features.settings
object VectorSettingsUrls {
const val HELP = "https://element.io/help"
const val COPYRIGHT = "https://element.io/copyright"
const val TAC = "https://element.io/terms-of-service"
const val PRIVACY_POLICY = "https://element.io/privacy"

View File

@ -2278,6 +2278,11 @@
<string name="preference_root_help_about">Help &amp; About</string>
<string name="preference_root_legals">Legals</string>
<string name="preference_help">Help</string>
<string name="preference_help_title">Help and support</string>
<string name="preference_help_summary">Get help with using Element</string>
<string name="preference_versions">Versions</string>
<string name="preference_system_settings">System settings</string>
<string name="settings_troubleshoot_test_token_registration_quick_fix">Register token</string>

View File

@ -2,24 +2,41 @@
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<im.vector.app.core.preference.VectorPreference
android:key="APP_INFO_LINK_PREFERENCE_KEY"
android:summary="@string/settings_app_info_link_summary"
android:title="@string/settings_app_info_link_title" />
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/preference_help">
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_VERSION_PREFERENCE_KEY"
android:title="@string/settings_version"
tools:summary="1.2.3" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_HELP_PREFERENCE_KEY"
android:summary="@string/preference_help_summary"
android:title="@string/preference_help_title" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_SDK_VERSION_PREFERENCE_KEY"
android:title="@string/settings_sdk_version"
tools:summary="4.5.6" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_OLM_VERSION_PREFERENCE_KEY"
android:title="@string/settings_olm_version"
tools:summary="7.8.9" />
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/preference_versions">
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_VERSION_PREFERENCE_KEY"
android:title="@string/settings_version"
tools:summary="1.2.3" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_SDK_VERSION_PREFERENCE_KEY"
android:title="@string/settings_sdk_version"
tools:summary="4.5.6" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_OLM_VERSION_PREFERENCE_KEY"
android:title="@string/settings_olm_version"
tools:summary="7.8.9" />
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/preference_system_settings">
<im.vector.app.core.preference.VectorPreference
android:key="APP_INFO_LINK_PREFERENCE_KEY"
android:summary="@string/settings_app_info_link_summary"
android:title="@string/settings_app_info_link_title" />
</im.vector.app.core.preference.VectorPreferenceCategory>
</androidx.preference.PreferenceScreen>