Pin setup: PR review
This commit is contained in:
parent
17c12899f5
commit
1f4cf15088
4 changed files with 5 additions and 36 deletions
|
|
@ -218,7 +218,7 @@ class LoggedInFlowNode @AssistedInject constructor(
|
||||||
createNode<LoggedInNode>(buildContext)
|
createNode<LoggedInNode>(buildContext)
|
||||||
}
|
}
|
||||||
NavTarget.LockPermanent -> {
|
NavTarget.LockPermanent -> {
|
||||||
pinEntryPoint.nodeBuilder(this, buildContext).build()
|
pinEntryPoint.createNode(this, buildContext)
|
||||||
}
|
}
|
||||||
NavTarget.RoomList -> {
|
NavTarget.RoomList -> {
|
||||||
val callback = object : RoomListEntryPoint.Callback {
|
val callback = object : RoomListEntryPoint.Callback {
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,6 @@
|
||||||
|
|
||||||
package io.element.android.features.pin.api
|
package io.element.android.features.pin.api
|
||||||
|
|
||||||
import com.bumble.appyx.core.modality.BuildContext
|
import io.element.android.libraries.architecture.SimpleFeatureEntryPoint
|
||||||
import com.bumble.appyx.core.node.Node
|
|
||||||
import com.bumble.appyx.core.plugin.Plugin
|
|
||||||
import io.element.android.libraries.architecture.FeatureEntryPoint
|
|
||||||
|
|
||||||
interface PinEntryPoint : FeatureEntryPoint {
|
|
||||||
|
|
||||||
fun nodeBuilder(parentNode: Node, buildContext: BuildContext): NodeBuilder
|
|
||||||
|
|
||||||
interface NodeBuilder {
|
|
||||||
fun callback(callback: Callback): NodeBuilder
|
|
||||||
fun build(): Node
|
|
||||||
}
|
|
||||||
|
|
||||||
interface Callback : Plugin {
|
|
||||||
// Add your callbacks
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
interface PinEntryPoint : SimpleFeatureEntryPoint
|
||||||
|
|
|
||||||
|
|
@ -14,8 +14,6 @@
|
||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// TODO: Remove once https://youtrack.jetbrains.com/issue/KTIJ-19369 is fixed
|
|
||||||
@Suppress("DSL_SCOPE_VIOLATION")
|
|
||||||
plugins {
|
plugins {
|
||||||
id("io.element.android-compose-library")
|
id("io.element.android-compose-library")
|
||||||
alias(libs.plugins.anvil)
|
alias(libs.plugins.anvil)
|
||||||
|
|
|
||||||
|
|
@ -18,7 +18,6 @@ package io.element.android.features.pin.impl
|
||||||
|
|
||||||
import com.bumble.appyx.core.modality.BuildContext
|
import com.bumble.appyx.core.modality.BuildContext
|
||||||
import com.bumble.appyx.core.node.Node
|
import com.bumble.appyx.core.node.Node
|
||||||
import com.bumble.appyx.core.plugin.Plugin
|
|
||||||
import com.squareup.anvil.annotations.ContributesBinding
|
import com.squareup.anvil.annotations.ContributesBinding
|
||||||
import io.element.android.features.pin.api.PinEntryPoint
|
import io.element.android.features.pin.api.PinEntryPoint
|
||||||
import io.element.android.libraries.architecture.createNode
|
import io.element.android.libraries.architecture.createNode
|
||||||
|
|
@ -28,19 +27,7 @@ import javax.inject.Inject
|
||||||
@ContributesBinding(AppScope::class)
|
@ContributesBinding(AppScope::class)
|
||||||
class DefaultPinEntryPoint @Inject constructor() : PinEntryPoint {
|
class DefaultPinEntryPoint @Inject constructor() : PinEntryPoint {
|
||||||
|
|
||||||
override fun nodeBuilder(parentNode: Node, buildContext: BuildContext): PinEntryPoint.NodeBuilder {
|
override fun createNode(parentNode: Node, buildContext: BuildContext): Node {
|
||||||
val plugins = ArrayList<Plugin>()
|
return parentNode.createNode<PinFlowNode>(buildContext)
|
||||||
|
|
||||||
return object : PinEntryPoint.NodeBuilder {
|
|
||||||
|
|
||||||
override fun callback(callback: PinEntryPoint.Callback): PinEntryPoint.NodeBuilder {
|
|
||||||
plugins += callback
|
|
||||||
return this
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun build(): Node {
|
|
||||||
return parentNode.createNode<PinFlowNode>(buildContext, plugins)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue