From b26d379d20603a9150a095fe02898e57e88c8572 Mon Sep 17 00:00:00 2001 From: Benoit Marty Date: Fri, 11 Sep 2020 11:49:14 +0200 Subject: [PATCH] Refresh push pref after diagnostic --- ...VectorSettingsNotificationPreferenceFragment.kt | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationPreferenceFragment.kt index 61dbe1705e..e7b9c3cb2a 100644 --- a/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/VectorSettingsNotificationPreferenceFragment.kt @@ -88,7 +88,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor( it.summary = secondsToText(vectorPreferences.backgroundSyncTimeOut()) it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> if (newValue is String) { - val syncTimeout = tryThis { Integer.parseInt(newValue) } ?: 6 + val syncTimeout = tryThis { Integer.parseInt(newValue) } ?: 6 vectorPreferences.setBackgroundSyncTimeout(maxOf(0, syncTimeout)) refreshBackgroundSyncPrefs() } @@ -101,7 +101,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor( it.summary = secondsToText(vectorPreferences.backgroundSyncDelay()) it.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> if (newValue is String) { - val syncDelay = tryThis { Integer.parseInt(newValue) } ?: 6 + val syncDelay = tryThis { Integer.parseInt(newValue) } ?: 6 vectorPreferences.setBackgroundSyncDelay(maxOf(0, syncDelay)) refreshBackgroundSyncPrefs() } @@ -244,6 +244,16 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor( val preference = findPreference(key) preference?.isHighlighted = true } + + refreshPref() + } + + private fun refreshPref() { + // This pref may have change from troubleshoot pref fragment + if (!FcmHelper.isPushSupported()) { + findPreference(VectorPreferences.SETTINGS_START_ON_BOOT_PREFERENCE_KEY) + ?.isChecked = vectorPreferences.autoStartOnBoot() + } } override fun onAttach(context: Context) {