Remove NodeBuilder to ensure that Params and Callback are always provided.

This commit is contained in:
Benoit Marty 2025-10-30 11:37:59 +01:00 committed by Benoit Marty
parent 5197154f54
commit 566515ca88
115 changed files with 954 additions and 1174 deletions

View file

@ -9,7 +9,6 @@ package io.element.android.libraries.troubleshoot.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.libraries.architecture.createNode
@ -17,18 +16,7 @@ import io.element.android.libraries.troubleshoot.api.NotificationTroubleShootEnt
@ContributesBinding(AppScope::class)
class DefaultNotificationTroubleShootEntryPoint : NotificationTroubleShootEntryPoint {
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NotificationTroubleShootEntryPoint.NodeBuilder {
val plugins = ArrayList<Plugin>()
return object : NotificationTroubleShootEntryPoint.NodeBuilder {
override fun callback(callback: NotificationTroubleShootEntryPoint.Callback): NotificationTroubleShootEntryPoint.NodeBuilder {
plugins += callback
return this
}
override fun build(): Node {
return parentNode.createNode<TroubleshootNotificationsNode>(buildContext, plugins)
}
}
override fun createNode(parentNode: Node, buildContext: BuildContext, callback: NotificationTroubleShootEntryPoint.Callback): Node {
return parentNode.createNode<TroubleshootNotificationsNode>(buildContext, listOf(callback))
}
}

View file

@ -9,7 +9,6 @@ package io.element.android.libraries.troubleshoot.impl.history
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.libraries.architecture.createNode
@ -17,18 +16,7 @@ import io.element.android.libraries.troubleshoot.api.PushHistoryEntryPoint
@ContributesBinding(AppScope::class)
class DefaultPushHistoryEntryPoint : PushHistoryEntryPoint {
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): PushHistoryEntryPoint.NodeBuilder {
val plugins = ArrayList<Plugin>()
return object : PushHistoryEntryPoint.NodeBuilder {
override fun callback(callback: PushHistoryEntryPoint.Callback): PushHistoryEntryPoint.NodeBuilder {
plugins += callback
return this
}
override fun build(): Node {
return parentNode.createNode<PushHistoryNode>(buildContext, plugins)
}
}
override fun createNode(parentNode: Node, buildContext: BuildContext, callback: PushHistoryEntryPoint.Callback): Node {
return parentNode.createNode<PushHistoryNode>(buildContext, listOf(callback))
}
}