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) {
|
private fun SwitchPreference.setTransactionalSwitchChangeListener(scope: CoroutineScope, transaction: suspend (Boolean) -> Unit) {
|
||||||
val originalState = this.isChecked
|
|
||||||
this.setOnPreferenceChangeListener { switchPreference, isChecked ->
|
this.setOnPreferenceChangeListener { switchPreference, isChecked ->
|
||||||
|
val originalState = this.isChecked
|
||||||
scope.launch {
|
scope.launch {
|
||||||
try {
|
try {
|
||||||
transaction(isChecked as Boolean)
|
transaction(isChecked as Boolean)
|
||||||
|
|
Loading…
Reference in New Issue