Use context parameter for the parentNode
This commit is contained in:
parent
02dc71c4c3
commit
f174084942
138 changed files with 450 additions and 375 deletions
|
|
@ -16,7 +16,8 @@ import io.element.android.libraries.architecture.createNode
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultJoinRoomEntryPoint : JoinRoomEntryPoint {
|
||||
override fun createNode(parentNode: Node, buildContext: BuildContext, inputs: JoinRoomEntryPoint.Inputs): Node {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(buildContext: BuildContext, inputs: JoinRoomEntryPoint.Inputs): Node {
|
||||
return parentNode.createNode<JoinRoomFlowNode>(
|
||||
buildContext = buildContext,
|
||||
plugins = listOf(inputs)
|
||||
|
|
|
|||
|
|
@ -64,7 +64,7 @@ class JoinRoomFlowNode(
|
|||
|
||||
override fun resolve(navTarget: NavTarget, buildContext: BuildContext): Node {
|
||||
return when (navTarget) {
|
||||
is NavTarget.DeclineInviteAndBlockUser -> declineAndBlockEntryPoint.createNode(this, buildContext, navTarget.inviteData)
|
||||
is NavTarget.DeclineInviteAndBlockUser -> declineAndBlockEntryPoint.createNode(buildContext, navTarget.inviteData)
|
||||
NavTarget.Root -> rootNode(buildContext)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -41,7 +41,8 @@ class DefaultJoinRoomEntryPointTest {
|
|||
presenterFactory = { _, _, _, _, _ -> createJoinRoomPresenter() },
|
||||
acceptDeclineInviteView = { _, _, _, _ -> lambdaError() },
|
||||
declineAndBlockEntryPoint = object : DeclineInviteAndBlockEntryPoint {
|
||||
override fun createNode(parentNode: Node, buildContext: BuildContext, inviteData: InviteData) = lambdaError()
|
||||
context(parentNode: Node)
|
||||
override fun createNode(buildContext: BuildContext, inviteData: InviteData) = lambdaError()
|
||||
}
|
||||
)
|
||||
}
|
||||
|
|
@ -52,7 +53,9 @@ class DefaultJoinRoomEntryPointTest {
|
|||
serverNames = emptyList(),
|
||||
trigger = JoinedRoom.Trigger.RoomDirectory,
|
||||
)
|
||||
val result = entryPoint.createNode(parentNode, BuildContext.root(null), inputs)
|
||||
val result = with(parentNode) {
|
||||
entryPoint.createNode(BuildContext.root(null), inputs)
|
||||
}
|
||||
assertThat(result).isInstanceOf(JoinRoomFlowNode::class.java)
|
||||
assertThat(result.plugins).contains(inputs)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue