Pin setup: PR review

This commit is contained in:
ganfra 2023-10-12 16:19:24 +02:00
parent 17c12899f5
commit 1f4cf15088
4 changed files with 5 additions and 36 deletions

View file

@ -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 {

View file

@ -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

View file

@ -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)

View file

@ -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)
}
}
} }
} }