Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
parent
45400d70d2
commit
e70d767183
161 changed files with 668 additions and 436 deletions
|
|
@ -18,8 +18,8 @@ import io.element.android.libraries.architecture.createNode
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultRoomDetailsEntryPoint : RoomDetailsEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
params: RoomDetailsEntryPoint.Params,
|
||||
callback: RoomDetailsEntryPoint.Callback,
|
||||
|
|
|
|||
|
|
@ -308,13 +308,14 @@ class RoomDetailsFlowNode(
|
|||
avatarUrl = navTarget.avatarUrl,
|
||||
)
|
||||
mediaViewerEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = params,
|
||||
callback = callback,
|
||||
)
|
||||
}
|
||||
is NavTarget.PollHistory -> {
|
||||
pollHistoryEntryPoint.createNode(buildContext)
|
||||
pollHistoryEntryPoint.createNode(this, buildContext)
|
||||
}
|
||||
is NavTarget.MediaGallery -> {
|
||||
val callback = object : MediaGalleryEntryPoint.Callback {
|
||||
|
|
@ -335,6 +336,7 @@ class RoomDetailsFlowNode(
|
|||
}
|
||||
}
|
||||
mediaGalleryEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
callback = callback,
|
||||
)
|
||||
|
|
@ -365,13 +367,14 @@ class RoomDetailsFlowNode(
|
|||
}
|
||||
}
|
||||
return messagesEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = params,
|
||||
callback = callback,
|
||||
)
|
||||
}
|
||||
NavTarget.KnockRequestsList -> {
|
||||
knockRequestsListEntryPoint.createNode(buildContext)
|
||||
knockRequestsListEntryPoint.createNode(this, buildContext)
|
||||
}
|
||||
NavTarget.SecurityAndPrivacy -> {
|
||||
createNode<SecurityAndPrivacyFlowNode>(buildContext)
|
||||
|
|
@ -382,6 +385,7 @@ class RoomDetailsFlowNode(
|
|||
verificationRequest = VerificationRequest.Outgoing.User(userId = navTarget.userId)
|
||||
)
|
||||
outgoingVerificationEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
params = params,
|
||||
callback = object : OutgoingVerificationEntryPoint.Callback {
|
||||
|
|
@ -400,11 +404,16 @@ class RoomDetailsFlowNode(
|
|||
)
|
||||
}
|
||||
is NavTarget.ReportRoom -> {
|
||||
reportRoomEntryPoint.createNode(buildContext, room.roomId)
|
||||
reportRoomEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
roomId = room.roomId,
|
||||
)
|
||||
}
|
||||
|
||||
is NavTarget.SelectNewOwnersWhenLeaving -> {
|
||||
changeRoomMemberRolesEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
room = room,
|
||||
listType = ChangeRoomMemberRolesListType.SelectNewOwnersWhenLeaving,
|
||||
|
|
|
|||
|
|
@ -102,6 +102,7 @@ class RolesAndPermissionsFlowNode(
|
|||
}
|
||||
is NavTarget.AdminList -> {
|
||||
changeRoomMemberRolesEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
room = joinedRoom,
|
||||
listType = ChangeRoomMemberRolesListType.Admins,
|
||||
|
|
@ -109,6 +110,7 @@ class RolesAndPermissionsFlowNode(
|
|||
}
|
||||
is NavTarget.ModeratorList -> {
|
||||
changeRoomMemberRolesEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
room = joinedRoom,
|
||||
listType = ChangeRoomMemberRolesListType.Moderators,
|
||||
|
|
|
|||
|
|
@ -69,13 +69,12 @@ class DefaultRoomDetailsEntryPointTest {
|
|||
val params = RoomDetailsEntryPoint.Params(
|
||||
initialElement = RoomDetailsEntryPoint.InitialTarget.RoomDetails,
|
||||
)
|
||||
val result = with(parentNode) {
|
||||
entryPoint.createNode(
|
||||
buildContext = BuildContext.root(null),
|
||||
params = params,
|
||||
callback = callback,
|
||||
)
|
||||
}
|
||||
val result = entryPoint.createNode(
|
||||
parentNode = parentNode,
|
||||
buildContext = BuildContext.root(null),
|
||||
params = params,
|
||||
callback = callback,
|
||||
)
|
||||
assertThat(result).isInstanceOf(RoomDetailsFlowNode::class.java)
|
||||
assertThat(result.plugins).contains(params)
|
||||
assertThat(result.plugins).contains(callback)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue