Properly skip the FTUE verification screen if verification is not needed.

This commit is contained in:
Benoit Marty 2024-09-04 16:28:35 +02:00 committed by Benoit Marty
parent 2c8b0d0b95
commit f32e7c7e02
9 changed files with 139 additions and 52 deletions

View file

@ -46,7 +46,7 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
private val secureBackupEntryPoint: SecureBackupEntryPoint,
) : BaseFlowNode<FtueSessionVerificationFlowNode.NavTarget>(
backstack = BackStack(
initialElement = NavTarget.Root,
initialElement = NavTarget.Root(showDeviceVerifiedScreen = false),
savedStateMap = buildContext.savedStateMap,
),
buildContext = buildContext,
@ -54,7 +54,7 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
) {
sealed interface NavTarget : Parcelable {
@Parcelize
data object Root : NavTarget
data class Root(val showDeviceVerifiedScreen: Boolean) : NavTarget
@Parcelize
data object EnterRecoveryKey : NavTarget
@ -71,7 +71,7 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
override fun onDone() {
lifecycleScope.launch {
// Move to the completed state view in the verification flow
backstack.newRoot(NavTarget.Root)
backstack.newRoot(NavTarget.Root(showDeviceVerifiedScreen = true))
}
}
}
@ -80,6 +80,7 @@ class FtueSessionVerificationFlowNode @AssistedInject constructor(
return when (navTarget) {
is NavTarget.Root -> {
verifySessionEntryPoint.nodeBuilder(this, buildContext)
.params(VerifySessionEntryPoint.Params(navTarget.showDeviceVerifiedScreen))
.callback(object : VerifySessionEntryPoint.Callback {
override fun onEnterRecoveryKey() {
backstack.push(NavTarget.EnterRecoveryKey)