Fix duplicated re-register UP distributor call
Second call is unnecessary, and can cause issues in the distributor: https://github.com/binwiederhier/ntfy/issues/230 Change-Id: I53f8ea38b424e8b4cc27b76001cd182429fa9439
This commit is contained in:
parent
8a1da1c02f
commit
93b9facbd2
@ -155,7 +155,7 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||
updateEnabledForDevice(false)
|
||||
UPHelper.registerUnifiedPush(requireContext(), forceShowSelection = true) {
|
||||
lifecycleScope.launch {
|
||||
updateEnabledForDevice(true)
|
||||
updateEnabledForDevice(true, reRegister = false)
|
||||
}
|
||||
Handler(Looper.getMainLooper()).postDelayed({ refreshBackgroundSyncPrefs() }, 500)
|
||||
}
|
||||
@ -391,9 +391,12 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun updateEnabledForDevice(enabled: Boolean) {
|
||||
private suspend fun updateEnabledForDevice(enabled: Boolean, reRegister: Boolean = true) {
|
||||
val pref = findPreference<VectorSwitchPreference>(VectorPreferences.SETTINGS_ENABLE_THIS_DEVICE_PREFERENCE_KEY)
|
||||
pref?.isChecked = enabled
|
||||
if (!reRegister) {
|
||||
return
|
||||
}
|
||||
if (enabled) {
|
||||
UPHelper.registerUnifiedPush(requireContext())
|
||||
} else {
|
||||
|
Loading…
x
Reference in New Issue
Block a user