mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-03 06:55:41 +00:00
Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
+6
-2
@@ -43,6 +43,10 @@ interface RoomDetailsEntryPoint : FeatureEntryPoint {
|
||||
fun startForwardEventFlow(eventId: EventId)
|
||||
}
|
||||
|
||||
context(parentNode: Node)
|
||||
fun createNode(buildContext: BuildContext, params: Params, callback: Callback): Node
|
||||
fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
params: Params,
|
||||
callback: Callback,
|
||||
): Node
|
||||
}
|
||||
|
||||
+1
-1
@@ -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,
|
||||
|
||||
+12
-3
@@ -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,
|
||||
|
||||
+2
@@ -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,
|
||||
|
||||
+6
-7
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user