Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
parent
f1822c5afd
commit
07b6148035
161 changed files with 668 additions and 436 deletions
|
|
@ -16,8 +16,7 @@ import io.element.android.libraries.architecture.createNode
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultFtueEntryPoint : FtueEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(buildContext: BuildContext): Node {
|
||||
override fun createNode(parentNode: Node, buildContext: BuildContext): Node {
|
||||
return parentNode.createNode<FtueFlowNode>(buildContext)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ class FtueFlowNode(
|
|||
createNode<NotificationsOptInNode>(buildContext, listOf(callback))
|
||||
}
|
||||
NavTarget.AnalyticsOptIn -> {
|
||||
analyticsEntryPoint.createNode(buildContext)
|
||||
analyticsEntryPoint.createNode(this, buildContext)
|
||||
}
|
||||
NavTarget.LockScreenSetup -> {
|
||||
val callback = object : LockScreenEntryPoint.Callback {
|
||||
|
|
@ -111,6 +111,7 @@ class FtueFlowNode(
|
|||
}
|
||||
}
|
||||
lockScreenEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
navTarget = LockScreenEntryPoint.Target.Setup,
|
||||
callback = callback,
|
||||
|
|
|
|||
|
|
@ -104,6 +104,7 @@ class FtueSessionVerificationFlowNode(
|
|||
}
|
||||
is NavTarget.UseAnotherDevice -> {
|
||||
outgoingVerificationEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = OutgoingVerificationEntryPoint.Params(
|
||||
showDeviceVerifiedScreen = true,
|
||||
|
|
@ -127,6 +128,7 @@ class FtueSessionVerificationFlowNode(
|
|||
}
|
||||
is NavTarget.EnterRecoveryKey -> {
|
||||
secureBackupEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.EnterRecoveryKey),
|
||||
callback = secureBackupEntryPointCallback
|
||||
|
|
@ -134,6 +136,7 @@ class FtueSessionVerificationFlowNode(
|
|||
}
|
||||
is NavTarget.ResetIdentity -> {
|
||||
secureBackupEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = SecureBackupEntryPoint.Params(SecureBackupEntryPoint.InitialTarget.ResetIdentity),
|
||||
callback = object : SecureBackupEntryPoint.Callback {
|
||||
|
|
|
|||
|
|
@ -32,14 +32,12 @@ class DefaultFtueEntryPointTest {
|
|||
FtueFlowNode(
|
||||
buildContext = buildContext,
|
||||
plugins = plugins,
|
||||
analyticsEntryPoint = { _ -> lambdaError() },
|
||||
analyticsEntryPoint = { _, _ -> lambdaError() },
|
||||
defaultFtueService = createDefaultFtueService(),
|
||||
lockScreenEntryPoint = FakeLockScreenEntryPoint(),
|
||||
)
|
||||
}
|
||||
val result = with(parentNode) {
|
||||
entryPoint.createNode(BuildContext.root(null))
|
||||
}
|
||||
val result = entryPoint.createNode(parentNode, BuildContext.root(null))
|
||||
assertThat(result).isInstanceOf(FtueFlowNode::class.java)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue