Ensure that all the callback instances are invoked.

This commit is contained in:
Benoit Marty 2024-07-05 12:13:21 +02:00
parent d000f956b6
commit a7de751f0e
3 changed files with 29 additions and 22 deletions

View file

@ -81,7 +81,7 @@ class SecureBackupFlowNode @AssistedInject constructor(
data object CreateNewRecoveryKey : NavTarget
}
private val callback = plugins<SecureBackupEntryPoint.Callback>().firstOrNull()
private val callbacks = plugins<SecureBackupEntryPoint.Callback>()
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
return when (navTarget) {
@ -130,8 +130,8 @@ class SecureBackupFlowNode @AssistedInject constructor(
NavTarget.EnterRecoveryKey -> {
val callback = object : SecureBackupEnterRecoveryKeyNode.Callback {
override fun onEnterRecoveryKeySuccess() {
if (callback != null) {
callback.onDone()
if (callbacks.isNotEmpty()) {
callbacks.forEach { it.onDone() }
} else {
backstack.pop()
}