Fix picker access and finish Wolfskin on root Back

This commit is contained in:
justinzeus 2026-11-07 18:02:17 +01:00
parent febcded034
commit 9cfe9362ee
11 changed files with 481 additions and 31 deletions

View file

@ -2,6 +2,8 @@ package com.github.damontecres.wholphin.services
import androidx.navigation3.runtime.NavBackStack
import com.github.damontecres.wholphin.ui.nav.Destination
import kotlinx.coroutines.channels.Channel
import kotlinx.coroutines.flow.receiveAsFlow
import org.acra.ACRA
import timber.log.Timber
import javax.inject.Inject
@ -15,6 +17,11 @@ class NavigationManager
@Inject
constructor() {
var backStack: MutableList<Destination> = NavBackStack(Destination.Home())
private val exits = Channel<Unit>(Channel.CONFLATED)
val exitRequests = exits.receiveAsFlow()
/** Finish the containing task; never expose an older setup/user entry. */
fun requestExit() { exits.trySend(Unit) }
/**
* Go to the specified [com.github.damontecres.wholphin.ui.nav.Destination]
@ -41,12 +48,14 @@ class NavigationManager
}
/**
* Go to the previous page
* Go to the previous page, or exit when there is no parent.
*/
fun goBack() {
synchronized(this) {
if (backStack.size > 1) {
backStack.removeLastOrNull()
} else {
requestExit()
}
}
log()