mirror of
https://github.com/Novaloop-AG/element-x-android.git
synced 2026-11-02 21:05:28 +00:00
Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
+1
-1
@@ -18,8 +18,8 @@ import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
* Allows a user to share a location message within a room.
|
||||
*/
|
||||
interface SendLocationEntryPoint : FeatureEntryPoint {
|
||||
context(parentNode: Node)
|
||||
fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
timelineMode: Timeline.Mode,
|
||||
): Node
|
||||
|
||||
+9
-3
@@ -13,8 +13,14 @@ import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||
import io.element.android.libraries.architecture.NodeInputs
|
||||
|
||||
interface ShowLocationEntryPoint : FeatureEntryPoint {
|
||||
data class Inputs(val location: Location, val description: String?) : NodeInputs
|
||||
data class Inputs(
|
||||
val location: Location,
|
||||
val description: String?,
|
||||
) : NodeInputs
|
||||
|
||||
context(parentNode: Node)
|
||||
fun createNode(buildContext: BuildContext, inputs: Inputs): Node
|
||||
fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
inputs: Inputs,
|
||||
): Node
|
||||
}
|
||||
|
||||
+1
-1
@@ -17,8 +17,8 @@ import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultSendLocationEntryPoint : SendLocationEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
timelineMode: Timeline.Mode,
|
||||
): Node {
|
||||
|
||||
+5
-2
@@ -16,8 +16,11 @@ import io.element.android.libraries.architecture.createNode
|
||||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultShowLocationEntryPoint : ShowLocationEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(buildContext: BuildContext, inputs: ShowLocationEntryPoint.Inputs): Node {
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
inputs: ShowLocationEntryPoint.Inputs,
|
||||
): Node {
|
||||
return parentNode.createNode<ShowLocationNode>(buildContext, listOf(inputs))
|
||||
}
|
||||
}
|
||||
|
||||
+5
-6
@@ -47,12 +47,11 @@ class DefaultSendLocationEntryPointTest {
|
||||
)
|
||||
}
|
||||
val timelineMode = Timeline.Mode.Live
|
||||
val result = with(parentNode) {
|
||||
entryPoint.createNode(
|
||||
buildContext = BuildContext.root(null),
|
||||
timelineMode = timelineMode,
|
||||
)
|
||||
}
|
||||
val result = entryPoint.createNode(
|
||||
parentNode = parentNode,
|
||||
buildContext = BuildContext.root(null),
|
||||
timelineMode = timelineMode,
|
||||
)
|
||||
assertThat(result).isInstanceOf(SendLocationNode::class.java)
|
||||
assertThat(result.plugins).contains(SendLocationNode.Inputs(timelineMode))
|
||||
}
|
||||
|
||||
+5
-6
@@ -47,12 +47,11 @@ class DefaultShowLocationEntryPointTest {
|
||||
location = Location(37.4219983, -122.084, 10f),
|
||||
description = "My location",
|
||||
)
|
||||
val result = with(parentNode) {
|
||||
entryPoint.createNode(
|
||||
buildContext = BuildContext.root(null),
|
||||
inputs = inputs,
|
||||
)
|
||||
}
|
||||
val result = entryPoint.createNode(
|
||||
parentNode = parentNode,
|
||||
buildContext = BuildContext.root(null),
|
||||
inputs = inputs,
|
||||
)
|
||||
assertThat(result).isInstanceOf(ShowLocationNode::class.java)
|
||||
assertThat(result.plugins).contains(inputs)
|
||||
}
|
||||
|
||||
+1
-1
@@ -14,8 +14,8 @@ import io.element.android.libraries.matrix.api.timeline.Timeline
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeSendLocationEntryPoint : SendLocationEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
timelineMode: Timeline.Mode,
|
||||
): Node = lambdaError()
|
||||
|
||||
+1
-1
@@ -13,8 +13,8 @@ import io.element.android.features.location.api.ShowLocationEntryPoint
|
||||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeShowLocationEntryPoint : ShowLocationEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
inputs: ShowLocationEntryPoint.Inputs,
|
||||
): Node = lambdaError()
|
||||
|
||||
Reference in New Issue
Block a user