Make it harder to not find "initial sync" option in settings

Change-Id: Iff49485ebe036a14bf03e274791275d5ff27d864
This commit is contained in:
SpiritCroc 2022-12-15 19:57:41 +01:00
parent 987ca6dec4
commit 1eacd0cca3
6 changed files with 40 additions and 2 deletions

View file

@ -210,4 +210,7 @@
<string name="settings_enable_member_name_click">Clickable names</string>
<string name="settings_enable_member_name_click_summary">Click on a username to mention them</string>
<string name="settings_initial_sync">Initial sync</string>
<string name="settings_initial_sync_summary">Discard local data and reload from server</string>
</resources>

View file

@ -69,6 +69,7 @@ class VectorPreferences @Inject constructor(
const val SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY = "SETTINGS_EMAILS_AND_PHONE_NUMBERS_PREFERENCE_KEY"
const val SETTINGS_CLEAR_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"
const val SETTINGS_INIT_SYNC_PREFERENCE_KEY = "SETTINGS_INIT_SYNC_PREFERENCE_KEY"
const val SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY = "SETTINGS_CLEAR_MEDIA_CACHE_PREFERENCE_KEY"
const val SETTINGS_USER_SETTINGS_PREFERENCE_KEY = "SETTINGS_USER_SETTINGS_PREFERENCE_KEY"
const val SETTINGS_CONTACT_PREFERENCE_KEYS = "SETTINGS_CONTACT_PREFERENCE_KEYS"

View file

@ -218,7 +218,11 @@ class VectorSettingsGeneralFragment :
setContactsPreferences()
// clear cache
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_CACHE_PREFERENCE_KEY)!!.let {
listOf(
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_CACHE_PREFERENCE_KEY),
findPreference<VectorPreference>(VectorPreferences.SETTINGS_INIT_SYNC_PREFERENCE_KEY)
).forEach {
it ?: return@forEach
/*
TODO
MXSession.getApplicationSizeCaches(activity, object : SimpleApiCallback<Long>() {

View file

@ -27,6 +27,8 @@ 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.MainActivity
import im.vector.app.features.MainActivityArgs
import im.vector.app.features.analytics.plan.MobileScreen
import im.vector.app.features.version.VersionProvider
import org.matrix.android.sdk.api.Matrix
@ -97,6 +99,20 @@ class VectorSettingsHelpAboutFragment :
// olm version
findPreference<VectorPreference>(VectorPreferences.SETTINGS_OLM_VERSION_PREFERENCE_KEY)!!
.summary = session.cryptoService().getCryptoVersion(requireContext(), false)
// clear cache
listOf(
findPreference<VectorPreference>(VectorPreferences.SETTINGS_CLEAR_CACHE_PREFERENCE_KEY),
findPreference<VectorPreference>(VectorPreferences.SETTINGS_INIT_SYNC_PREFERENCE_KEY)
).forEach {
it ?: return@forEach
it.onPreferenceClickListener = Preference.OnPreferenceClickListener {
displayLoadingView()
MainActivity.restartApp(requireActivity(), MainActivityArgs(clearCache = true))
false
}
}
}
companion object {

View file

@ -97,6 +97,11 @@
android:key="SETTINGS_CLEAR_CACHE_PREFERENCE_KEY"
android:title="@string/settings_clear_cache" />
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_INIT_SYNC_PREFERENCE_KEY"
android:title="@string/settings_initial_sync"
android:summary="@string/settings_initial_sync_summary"/>
</im.vector.app.core.preference.VectorPreferenceCategory>
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/action_sign_out">

View file

@ -39,4 +39,13 @@
</im.vector.app.core.preference.VectorPreferenceCategory>
</androidx.preference.PreferenceScreen>
<im.vector.app.core.preference.VectorPreferenceCategory android:title="@string/settings_advanced">
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_INIT_SYNC_PREFERENCE_KEY"
android:title="@string/settings_initial_sync"
android:summary="@string/settings_initial_sync_summary"/>
</im.vector.app.core.preference.VectorPreferenceCategory>
</androidx.preference.PreferenceScreen>