Revert the check box in case of error

This commit is contained in:
Benoit Marty 2020-03-06 17:24:57 +01:00
parent 4261b0e78a
commit 937d497a1f

View file

@ -168,11 +168,14 @@ class VectorSettingsNotificationPreferenceFragment @Inject constructor(
pushManager.unregisterPusher(it, object : MatrixCallback<Unit> { pushManager.unregisterPusher(it, object : MatrixCallback<Unit> {
override fun onSuccess(data: Unit) { override fun onSuccess(data: Unit) {
session.refreshPushers() session.refreshPushers()
super.onSuccess(data)
} }
override fun onFailure(failure: Throwable) { override fun onFailure(failure: Throwable) {
session.refreshPushers() if (!isAdded) {
return
}
// revert the check box
switchPref.isChecked = !switchPref.isChecked
Toast.makeText(activity, R.string.unknown_error, Toast.LENGTH_SHORT).show() Toast.makeText(activity, R.string.unknown_error, Toast.LENGTH_SHORT).show()
} }
}) })