Remove context(parentNode: Node) and provide the parent Node as a parameter.

This commit is contained in:
Benoit Marty 2025-10-31 12:04:57 +01:00
parent 45400d70d2
commit e70d767183
161 changed files with 668 additions and 436 deletions

View file

@ -13,8 +13,11 @@ import com.bumble.appyx.core.plugin.Plugin
import io.element.android.libraries.architecture.FeatureEntryPoint
interface NotificationTroubleShootEntryPoint : FeatureEntryPoint {
context(parentNode: Node)
fun createNode(buildContext: BuildContext, callback: Callback): Node
fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: Callback,
): Node
interface Callback : Plugin {
fun onDone()

View file

@ -15,8 +15,11 @@ import io.element.android.libraries.matrix.api.core.EventId
import io.element.android.libraries.matrix.api.core.RoomId
interface PushHistoryEntryPoint : FeatureEntryPoint {
context(parentNode: Node)
fun createNode(buildContext: BuildContext, callback: Callback): Node
fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: Callback,
): Node
interface Callback : Plugin {
fun onDone()

View file

@ -16,8 +16,11 @@ import io.element.android.libraries.troubleshoot.api.NotificationTroubleShootEnt
@ContributesBinding(AppScope::class)
class DefaultNotificationTroubleShootEntryPoint : NotificationTroubleShootEntryPoint {
context(parentNode: Node)
override fun createNode(buildContext: BuildContext, callback: NotificationTroubleShootEntryPoint.Callback): Node {
override fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: NotificationTroubleShootEntryPoint.Callback,
): Node {
return parentNode.createNode<TroubleshootNotificationsNode>(buildContext, listOf(callback))
}
}

View file

@ -16,8 +16,11 @@ import io.element.android.libraries.troubleshoot.api.PushHistoryEntryPoint
@ContributesBinding(AppScope::class)
class DefaultPushHistoryEntryPoint : PushHistoryEntryPoint {
context(parentNode: Node)
override fun createNode(buildContext: BuildContext, callback: PushHistoryEntryPoint.Callback): Node {
override fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: PushHistoryEntryPoint.Callback,
): Node {
return parentNode.createNode<PushHistoryNode>(buildContext, listOf(callback))
}
}

View file

@ -36,12 +36,11 @@ class DefaultNotificationTroubleShootEntryPointTest {
override fun onDone() = lambdaError()
override fun navigateToBlockedUsers() = lambdaError()
}
val result = with(parentNode) {
entryPoint.createNode(
buildContext = BuildContext.root(null),
callback = callback,
)
}
val result = entryPoint.createNode(
parentNode = parentNode,
buildContext = BuildContext.root(null),
callback = callback,
)
assertThat(result).isInstanceOf(TroubleshootNotificationsNode::class.java)
assertThat(result.plugins).contains(callback)
}

View file

@ -48,12 +48,11 @@ class DefaultPushHistoryEntryPointTest {
override fun onDone() = lambdaError()
override fun navigateToEvent(roomId: RoomId, eventId: EventId) = lambdaError()
}
val result = with(parentNode) {
entryPoint.createNode(
buildContext = BuildContext.root(null),
callback = callback,
)
}
val result = entryPoint.createNode(
parentNode = parentNode,
buildContext = BuildContext.root(null),
callback = callback,
)
assertThat(result).isInstanceOf(PushHistoryNode::class.java)
assertThat(result.plugins).contains(callback)
}

View file

@ -13,8 +13,8 @@ import io.element.android.libraries.troubleshoot.api.NotificationTroubleShootEnt
import io.element.android.tests.testutils.lambda.lambdaError
class FakeNotificationTroubleShootEntryPoint : NotificationTroubleShootEntryPoint {
context(parentNode: Node)
override fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: NotificationTroubleShootEntryPoint.Callback,
): Node = lambdaError()

View file

@ -13,8 +13,8 @@ import io.element.android.libraries.troubleshoot.api.PushHistoryEntryPoint
import io.element.android.tests.testutils.lambda.lambdaError
class FakePushHistoryEntryPoint : PushHistoryEntryPoint {
context(parentNode: Node)
override fun createNode(
parentNode: Node,
buildContext: BuildContext,
callback: PushHistoryEntryPoint.Callback,
): Node = lambdaError()