mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 15:44:54 +00:00
Fix reset identity with password stuck in loading state. (#3317)
Make sure `resetIdentityFlowManager.whenResetIsDone` is registered *after* the previous reset attempt is cancelled, otherwise the current one will be cancelled instead.
This commit is contained in:
committed by
GitHub
parent
534e3a8585
commit
0686745fd4
+10
-8
@@ -87,20 +87,22 @@ class ResetIdentityFlowNode @AssistedInject constructor(
|
|||||||
override fun onBuilt() {
|
override fun onBuilt() {
|
||||||
super.onBuilt()
|
super.onBuilt()
|
||||||
|
|
||||||
resetIdentityFlowManager.whenResetIsDone {
|
|
||||||
plugins<Callback>().forEach { it.onDone() }
|
|
||||||
}
|
|
||||||
|
|
||||||
lifecycle.addObserver(object : DefaultLifecycleObserver {
|
lifecycle.addObserver(object : DefaultLifecycleObserver {
|
||||||
override fun onStart(owner: LifecycleOwner) {
|
override fun onStart(owner: LifecycleOwner) {
|
||||||
// If the custom tab was opened, we need to cancel the reset job
|
// If the custom tab was opened, we need to cancel the reset job
|
||||||
// when we come back to the node if the reset wasn't successful
|
// when we come back to the node if the reset wasn't successful
|
||||||
|
coroutineScope.launch {
|
||||||
cancelResetJob()
|
cancelResetJob()
|
||||||
|
|
||||||
|
resetIdentityFlowManager.whenResetIsDone {
|
||||||
|
plugins<Callback>().forEach { it.onDone() }
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroy(owner: LifecycleOwner) {
|
override fun onDestroy(owner: LifecycleOwner) {
|
||||||
// Make sure we cancel the reset job when the node is destroyed, just in case
|
// Make sure we cancel the reset job when the node is destroyed, just in case
|
||||||
cancelResetJob()
|
coroutineScope.launch { cancelResetJob() }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -154,10 +156,10 @@ class ResetIdentityFlowNode @AssistedInject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun cancelResetJob() {
|
private suspend fun cancelResetJob() {
|
||||||
resetJob?.cancel()
|
resetJob?.cancel()
|
||||||
resetJob = null
|
resetJob = null
|
||||||
coroutineScope.launch { resetIdentityFlowManager.cancel() }
|
resetIdentityFlowManager.cancel()
|
||||||
}
|
}
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
@@ -171,7 +173,7 @@ class ResetIdentityFlowNode @AssistedInject constructor(
|
|||||||
if (startResetState.isLoading()) {
|
if (startResetState.isLoading()) {
|
||||||
ProgressDialog(
|
ProgressDialog(
|
||||||
properties = DialogProperties(dismissOnBackPress = true, dismissOnClickOutside = true),
|
properties = DialogProperties(dismissOnBackPress = true, dismissOnClickOutside = true),
|
||||||
onDismissRequest = { cancelResetJob() }
|
onDismissRequest = { coroutineScope.launch { cancelResetJob() } }
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user