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 efa56e6124
commit fb451282fe
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,
)
}
}