Remove NodeBuilder to ensure that Params and Callback are always provided.

This commit is contained in:
Benoit Marty 2025-10-30 11:37:59 +01:00 committed by Benoit Marty
parent be03c50aaf
commit 02dc71c4c3
115 changed files with 954 additions and 1174 deletions

View file

@ -110,9 +110,12 @@ class FtueFlowNode(
defaultFtueService.updateFtueStep()
}
}
lockScreenEntryPoint.nodeBuilder(this, buildContext, LockScreenEntryPoint.Target.Setup)
.callback(callback)
.build()
lockScreenEntryPoint.createNode(
parentNode = this,
buildContext = buildContext,
navTarget = LockScreenEntryPoint.Target.Setup,
callback = callback,
)
}
}
}

View file

@ -103,14 +103,14 @@ class FtueSessionVerificationFlowNode(
createNode<ChooseSelfVerificationModeNode>(buildContext, plugins = listOf(callback))
}
is NavTarget.UseAnotherDevice -> {
outgoingVerificationEntryPoint.nodeBuilder(this, buildContext)
.params(
OutgoingVerificationEntryPoint.Params(
showDeviceVerifiedScreen = true,
verificationRequest = VerificationRequest.Outgoing.CurrentSession,
)
)
.callback(object : OutgoingVerificationEntryPoint.Callback {
outgoingVerificationEntryPoint.createNode(
parentNode = this,
buildContext = buildContext,
params = OutgoingVerificationEntryPoint.Params(
showDeviceVerifiedScreen = true,
verificationRequest = VerificationRequest.Outgoing.CurrentSession,
),
callback = object : OutgoingVerificationEntryPoint.Callback {
override fun onDone() {
callback.onDone()
}
@ -123,24 +123,28 @@ class FtueSessionVerificationFlowNode(
// Note that this callback is never called. The "Learn more" link is not displayed
// for the self session interactive verification.
}
})
.build()
}
)
}
is NavTarget.EnterRecoveryKey -> {
secureBackupEntryPoint.nodeBuilder(this, buildContext)
.params(SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey))
.callback(secureBackupEntryPointCallback)
.build()
secureBackupEntryPoint.createNode(
parentNode = this,
buildContext = buildContext,
params = SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey),
callback = secureBackupEntryPointCallback
)
}
is NavTarget.ResetIdentity -> {
secureBackupEntryPoint.nodeBuilder(this, buildContext)
.params(SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.ResetIdentity))
.callback(object : SecureBackupEntryPoint.Callback {
secureBackupEntryPoint.createNode(
parentNode = this,
buildContext = buildContext,
params = SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.ResetIdentity),
callback = object : SecureBackupEntryPoint.Callback {
override fun onDone() {
callback.onDone()
}
})
.build()
},
)
}
}
}

View file

@ -11,6 +11,7 @@ import android.content.Context
import android.content.Intent
import androidx.arch.core.executor.testing.InstantTaskExecutorRule
import com.bumble.appyx.core.modality.BuildContext
import com.bumble.appyx.core.node.Node
import com.bumble.appyx.testing.junit4.util.MainDispatcherRule
import com.google.common.truth.Truth.assertThat
import io.element.android.features.lockscreen.api.LockScreenEntryPoint
@ -37,13 +38,12 @@ class DefaultFtueEntryPointTest {
analyticsEntryPoint = { _, _ -> lambdaError() },
defaultFtueService = createDefaultFtueService(),
lockScreenEntryPoint = object : LockScreenEntryPoint {
override fun nodeBuilder(
parentNode: com.bumble.appyx.core.node.Node,
override fun createNode(
parentNode: Node,
buildContext: BuildContext,
navTarget: LockScreenEntryPoint.Target
): LockScreenEntryPoint.NodeBuilder {
lambdaError()
}
navTarget: LockScreenEntryPoint.Target,
callback: LockScreenEntryPoint.Callback,
) = lambdaError()
override fun pinUnlockIntent(context: Context): Intent {
lambdaError()