Remove context(parentNode: Node) and provide the parent Node as a parameter.
This commit is contained in:
parent
45400d70d2
commit
e70d767183
161 changed files with 668 additions and 436 deletions
|
|
@ -13,8 +13,11 @@ import com.bumble.appyx.core.plugin.Plugin
|
|||
import io.element.android.libraries.architecture.FeatureEntryPoint
|
||||
|
||||
interface LogoutEntryPoint : FeatureEntryPoint {
|
||||
context(parentNode: Node)
|
||||
fun createNode(buildContext: BuildContext, callback: Callback): Node
|
||||
fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
callback: Callback,
|
||||
): Node
|
||||
|
||||
interface Callback : Plugin {
|
||||
fun navigateToSecureBackup()
|
||||
|
|
|
|||
|
|
@ -16,8 +16,11 @@ import io.element.android.libraries.architecture.createNode
|
|||
|
||||
@ContributesBinding(AppScope::class)
|
||||
class DefaultLogoutEntryPoint : LogoutEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(buildContext: BuildContext, callback: LogoutEntryPoint.Callback): Node {
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
callback: LogoutEntryPoint.Callback,
|
||||
): Node {
|
||||
return parentNode.createNode<LogoutNode>(buildContext, listOf(callback))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,12 +34,11 @@ class DefaultLogoutEntryPointTest {
|
|||
val callback = object : LogoutEntryPoint.Callback {
|
||||
override fun navigateToSecureBackup() = 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(LogoutNode::class.java)
|
||||
assertThat(result.plugins).contains(callback)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -13,8 +13,8 @@ import io.element.android.features.logout.api.LogoutEntryPoint
|
|||
import io.element.android.tests.testutils.lambda.lambdaError
|
||||
|
||||
class FakeLogoutEntryPoint : LogoutEntryPoint {
|
||||
context(parentNode: Node)
|
||||
override fun createNode(
|
||||
parentNode: Node,
|
||||
buildContext: BuildContext,
|
||||
callback: LogoutEntryPoint.Callback,
|
||||
): Node = lambdaError()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue