removing boolean notification version usage
This commit is contained in:
parent
8a0fe41b80
commit
db406704c9
|
@ -47,6 +47,9 @@ class VectorPreferences @Inject constructor(private val context: Context) {
|
|||
const val SETTINGS_DISCOVERY_PREFERENCE_KEY = "SETTINGS_DISCOVERY_PREFERENCE_KEY"
|
||||
|
||||
const val SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY"
|
||||
const val SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY"
|
||||
const val SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY"
|
||||
const val SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY = "SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY"
|
||||
const val SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
||||
const val SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY = "SETTINGS_OTHER_THIRD_PARTY_NOTICES_PREFERENCE_KEY"
|
||||
const val SETTINGS_COPYRIGHT_PREFERENCE_KEY = "SETTINGS_COPYRIGHT_PREFERENCE_KEY"
|
||||
|
|
|
@ -40,6 +40,7 @@ import im.vector.app.core.pushers.PushersManager
|
|||
import im.vector.app.core.services.GuardServiceStarter
|
||||
import im.vector.app.core.utils.isIgnoringBatteryOptimizations
|
||||
import im.vector.app.core.utils.requestDisablingBatteryOptimization
|
||||
import im.vector.app.features.VectorFeatures
|
||||
import im.vector.app.features.notifications.NotificationUtils
|
||||
import im.vector.app.features.settings.BackgroundSyncMode
|
||||
import im.vector.app.features.settings.BackgroundSyncModeChooserDialog
|
||||
|
@ -63,7 +64,8 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||
private val pushManager: PushersManager,
|
||||
private val activeSessionHolder: ActiveSessionHolder,
|
||||
private val vectorPreferences: VectorPreferences,
|
||||
private val guardServiceStarter: GuardServiceStarter
|
||||
private val guardServiceStarter: GuardServiceStarter,
|
||||
private val features: VectorFeatures
|
||||
) : VectorSettingsBaseFragment(),
|
||||
BackgroundSyncModeChooserDialog.InteractionListener {
|
||||
|
||||
|
@ -145,6 +147,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||
refreshBackgroundSyncPrefs()
|
||||
|
||||
handleSystemPreference()
|
||||
handleVersionedSettings()
|
||||
}
|
||||
|
||||
private fun bindEmailNotifications() {
|
||||
|
@ -309,6 +312,15 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||
}
|
||||
}
|
||||
|
||||
private fun handleVersionedSettings() {
|
||||
val isNotificationSettingsV2Enabled = features.notificationSettingsVersion() == VectorFeatures.NotificationSettingsVersion.V2
|
||||
|
||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_ADVANCED_PREFERENCE_KEY)?.isVisible = !isNotificationSettingsV2Enabled
|
||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
||||
findPreference<Preference>(VectorPreferences.SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY)?.isVisible = isNotificationSettingsV2Enabled
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
activeSessionHolder.getSafeActiveSession()?.refreshPushers()
|
||||
|
|
|
@ -26,38 +26,34 @@
|
|||
android:persistent="false"
|
||||
android:summary="@string/settings_notification_advanced_summary"
|
||||
android:title="@string/settings_notification_advanced"
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsAdvancedNotificationPreferenceFragment"
|
||||
app:isPreferenceVisible="@bool/useNotificationSettingsV1" />
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsAdvancedNotificationPreferenceFragment" />
|
||||
|
||||
<im.vector.app.core.preference.VectorPreference
|
||||
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
||||
android:key="SETTINGS_NOTIFICATION_DEFAULT_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_notification_default"
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsDefaultNotificationPreferenceFragment"
|
||||
app:isPreferenceVisible="@bool/useNotificationSettingsV2"/>
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsDefaultNotificationPreferenceFragment" />
|
||||
|
||||
<im.vector.app.core.preference.VectorPreference
|
||||
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
||||
android:key="SETTINGS_NOTIFICATION_KEYWORD_AND_MENTIONS_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_notification_mentions_and_keywords"
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsKeywordAndMentionsNotificationPreferenceFragment"
|
||||
app:isPreferenceVisible="@bool/useNotificationSettingsV2"/>
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsKeywordAndMentionsNotificationPreferenceFragment" />
|
||||
|
||||
<im.vector.app.core.preference.VectorPreference
|
||||
android:dependency="SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY"
|
||||
android:key="SETTINGS_NOTIFICATION_OTHER_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_notification_other"
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsOtherNotificationPreferenceFragment"
|
||||
app:isPreferenceVisible="@bool/useNotificationSettingsV2"/>
|
||||
app:fragment="im.vector.app.features.settings.notifications.VectorSettingsOtherNotificationPreferenceFragment" />
|
||||
|
||||
</im.vector.app.core.preference.VectorPreferenceCategory>
|
||||
|
||||
<im.vector.app.core.preference.VectorPreferenceCategory
|
||||
android:key="SETTINGS_EMAIL_NOTIFICATION_CATEGORY_PREFERENCE_KEY"
|
||||
android:title="@string/settings_notification_emails_category"/>
|
||||
android:title="@string/settings_notification_emails_category" />
|
||||
|
||||
<im.vector.app.core.preference.VectorPreferenceCategory
|
||||
android:persistent="false"
|
||||
|
@ -103,14 +99,14 @@
|
|||
|
||||
<im.vector.app.core.preference.VectorEditTextPreference
|
||||
android:inputType="numberDecimal"
|
||||
android:persistent="false"
|
||||
android:key="SETTINGS_SET_SYNC_DELAY_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_set_sync_delay" />
|
||||
|
||||
<im.vector.app.core.preference.VectorEditTextPreference
|
||||
android:inputType="numberDecimal"
|
||||
android:persistent="false"
|
||||
android:key="SETTINGS_SET_SYNC_TIMEOUT_PREFERENCE_KEY"
|
||||
android:persistent="false"
|
||||
android:title="@string/settings_set_sync_timeout" />
|
||||
|
||||
<im.vector.app.core.preference.VectorSwitchPreference
|
||||
|
|
Loading…
Reference in New Issue