mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 12:07:28 +00:00
Remove NodeBuilder to ensure that Params and Callback are always provided.
This commit is contained in:
committed by
Benoit Marty
parent
be03c50aaf
commit
02dc71c4c3
+2
-14
@@ -9,7 +9,6 @@ package io.element.android.features.startchat.impl
|
||||
|
||||
import com.bumble.appyx.core.modality.BuildContext
|
||||
import com.bumble.appyx.core.node.Node
|
||||
import com.bumble.appyx.core.plugin.Plugin
|
||||
import dev.zacsweers.metro.AppScope
|
||||
import dev.zacsweers.metro.ContributesBinding
|
||||
import io.element.android.features.startchat.api.StartChatEntryPoint
|
||||
@@ -17,18 +16,7 @@ import io.element.android.libraries.architecture.createNode
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultStartChatEntryPoint : StartChatEntryPoint {
|
||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): StartChatEntryPoint.NodeBuilder {
|
||||
val plugins = ArrayList<Plugin>()
|
||||
|
||||
return object : StartChatEntryPoint.NodeBuilder {
|
||||
override fun callback(callback: StartChatEntryPoint.Callback): StartChatEntryPoint.NodeBuilder {
|
||||
plugins += callback
|
||||
return this
|
||||
}
|
||||
|
||||
override fun build(): Node {
|
||||
return parentNode.createNode<StartChatFlowNode>(buildContext, plugins)
|
||||
}
|
||||
}
|
||||
override fun createNode(parentNode: Node, buildContext: BuildContext, callback: StartChatEntryPoint.Callback): Node {
|
||||
return parentNode.createNode<StartChatFlowNode>(buildContext, listOf(callback))
|
||||
}
|
||||
}
|
||||
|
||||
+5
-3
@@ -79,9 +79,11 @@ class StartChatFlowNode(
|
||||
navigator.onRoomCreated(roomId.toRoomIdOrAlias(), emptyList())
|
||||
}
|
||||
}
|
||||
createRoomEntryPoint.nodeBuilder(parentNode = this, buildContext = buildContext)
|
||||
.callback(callback)
|
||||
.build()
|
||||
createRoomEntryPoint.createNode(
|
||||
parentNode = this,
|
||||
buildContext = buildContext,
|
||||
callback = callback,
|
||||
)
|
||||
}
|
||||
NavTarget.JoinByAddress -> {
|
||||
createNode<JoinRoomByAddressNode>(buildContext = buildContext, plugins = listOf(navigator))
|
||||
|
||||
Reference in New Issue
Block a user