Fix crash when clicking fast on back key on the Labs screen.
This commit is contained in:
parent
24b76f2001
commit
883fb36fcc
2 changed files with 17 additions and 2 deletions
|
|
@ -190,7 +190,12 @@ class PreferencesFlowNode(
|
||||||
createNode<DeveloperSettingsNode>(buildContext, listOf(developerSettingsCallback))
|
createNode<DeveloperSettingsNode>(buildContext, listOf(developerSettingsCallback))
|
||||||
}
|
}
|
||||||
NavTarget.Labs -> {
|
NavTarget.Labs -> {
|
||||||
createNode<LabsNode>(buildContext)
|
val callback = object : LabsNode.Callback {
|
||||||
|
override fun onDone() {
|
||||||
|
backstack.pop()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
createNode<LabsNode>(buildContext, listOf(callback))
|
||||||
}
|
}
|
||||||
NavTarget.About -> {
|
NavTarget.About -> {
|
||||||
val callback = object : AboutNode.Callback {
|
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.Assisted
|
||||||
import dev.zacsweers.metro.AssistedInject
|
import dev.zacsweers.metro.AssistedInject
|
||||||
import io.element.android.annotations.ContributesNode
|
import io.element.android.annotations.ContributesNode
|
||||||
|
import io.element.android.libraries.architecture.callback
|
||||||
import io.element.android.libraries.di.SessionScope
|
import io.element.android.libraries.di.SessionScope
|
||||||
|
|
||||||
@ContributesNode(SessionScope::class)
|
@ContributesNode(SessionScope::class)
|
||||||
|
|
@ -25,9 +26,18 @@ class LabsNode(
|
||||||
@Assisted plugins: List<Plugin>,
|
@Assisted plugins: List<Plugin>,
|
||||||
private val presenter: LabsPresenter,
|
private val presenter: LabsPresenter,
|
||||||
) : Node(buildContext, plugins = plugins) {
|
) : Node(buildContext, plugins = plugins) {
|
||||||
|
interface Callback : Plugin {
|
||||||
|
fun onDone()
|
||||||
|
}
|
||||||
|
|
||||||
|
val callback: Callback = callback()
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
override fun View(modifier: Modifier) {
|
override fun View(modifier: Modifier) {
|
||||||
val state = presenter.present()
|
val state = presenter.present()
|
||||||
LabsView(state = state, onBack = ::navigateUp)
|
LabsView(
|
||||||
|
state = state,
|
||||||
|
onBack = callback::onDone,
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue