Fix crash when clicking fast on back key on the Labs screen.
This commit is contained in:
@@ -190,7 +190,12 @@ class PreferencesFlowNode(
|
||||
createNode<DeveloperSettingsNode>(buildContext, listOf(developerSettingsCallback))
|
||||
}
|
||||
NavTarget.Labs -> {
|
||||
createNode<LabsNode>(buildContext)
|
||||
val callback = object : LabsNode.Callback {
|
||||
override fun onDone() {
|
||||
backstack.pop()
|
||||
}
|
||||
}
|
||||
createNode<LabsNode>(buildContext, listOf(callback))
|
||||
}
|
||||
NavTarget.About -> {
|
||||
val callback = object : AboutNode.Callback {
|
||||
|
||||
@@ -16,6 +16,7 @@ import com.bumble.appyx.core.plugin.Plugin
|
||||
import dev.zacsweers.metro.Assisted
|
||||
import dev.zacsweers.metro.AssistedInject
|
||||
import io.element.android.annotations.ContributesNode
|
||||
import io.element.android.libraries.architecture.callback
|
||||
import io.element.android.libraries.di.SessionScope
|
||||
|
||||
@ContributesNode(SessionScope::class)
|
||||
@@ -25,9 +26,18 @@ class LabsNode(
|
||||
@Assisted plugins: List<Plugin>,
|
||||
private val presenter: LabsPresenter,
|
||||
) : Node(buildContext, plugins = plugins) {
|
||||
interface Callback : Plugin {
|
||||
fun onDone()
|
||||
}
|
||||
|
||||
val callback: Callback = callback()
|
||||
|
||||
@Composable
|
||||
override fun View(modifier: Modifier) {
|
||||
val state = presenter.present()
|
||||
LabsView(state = state, onBack = ::navigateUp)
|
||||
LabsView(
|
||||
state = state,
|
||||
onBack = callback::onDone,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user