capturing the original switch state at the point of clicking the switch rather than when the listener is initially set
This commit is contained in:
parent
710f2f92cb
commit
03eb36636d
|
@ -386,8 +386,8 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
|
|||
}
|
||||
|
||||
private fun SwitchPreference.setTransactionalSwitchChangeListener(scope: CoroutineScope, transaction: suspend (Boolean) -> Unit) {
|
||||
val originalState = this.isChecked
|
||||
this.setOnPreferenceChangeListener { switchPreference, isChecked ->
|
||||
val originalState = this.isChecked
|
||||
scope.launch {
|
||||
try {
|
||||
transaction(isChecked as Boolean)
|
||||
|
|
Loading…
Reference in New Issue