mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:32:34 +00:00
Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
+5
-2
@@ -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()
|
||||
|
||||
+5
-2
@@ -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()
|
||||
|
||||
+5
-2
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
+5
-2
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -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)
|
||||
}
|
||||
|
||||
+5
-6
@@ -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)
|
||||
}
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
+1
-1
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user