Use method references, and avoid using navigateUp(): let the parent Node decide how to navigate.

This commit is contained in:
Benoit Marty 2024-02-22 08:57:12 +01:00
parent f68087bc79
commit bd8b234f59
3 changed files with 13 additions and 2 deletions

View file

@ -338,6 +338,10 @@ class LoggedInFlowNode @AssistedInject constructor(
)
)
}
override fun onDone() {
backstack.pop()
}
}
verifySessionEntryPoint
.nodeBuilder(this, buildContext)

View file

@ -31,5 +31,6 @@ interface VerifySessionEntryPoint : FeatureEntryPoint {
interface Callback : Plugin {
fun onEnterRecoveryKey()
fun onDone()
}
}

View file

@ -40,14 +40,20 @@ class VerifySelfSessionNode @AssistedInject constructor(
}
}
private fun onDone() {
plugins<VerifySessionEntryPoint.Callback>().forEach {
it.onDone()
}
}
@Composable
override fun View(modifier: Modifier) {
val state = presenter.present()
VerifySelfSessionView(
state = state,
modifier = modifier,
onEnterRecoveryKey = { onEnterRecoveryKey() },
goBack = { navigateUp() }
onEnterRecoveryKey = ::onEnterRecoveryKey,
goBack = ::onDone,
)
}
}