Recover failed person switches without changing identity

This commit is contained in:
justinzeus 2026-11-08 16:49:53 +01:00
parent c21d17dfdf
commit 9355288f79
11 changed files with 400 additions and 68 deletions

View file

@ -68,4 +68,5 @@ object RecoveryMessage {
const val StillUnreachable = "Still can’t reach it. The last saved view stays on screen."
const val PlaybackUnavailable = "Can’t reach Jellyfin to play. Check the network and try again."
const val TitleActionUnavailable = "Can’t update this title right now."
const val PersonSwitchUnavailable = "The household server didn’t answer. Choose a profile or try again."
}

View file

@ -12,7 +12,7 @@ data class ShellPerson(val key: String, val name: String, val initial: String, v
/** The shell owns keys; the integration owns navigation and authenticated user changes. */
sealed interface ShellAction {
data class Destination(val route: String, val preservePushed: Boolean = false) : ShellAction
data class Person(val person: ShellPerson) : ShellAction
data class Person(val person: ShellPerson, val fromLaunch: Boolean) : ShellAction
data class HandOff(val group: String) : ShellAction
data object Pop : ShellAction
data object Exit : ShellAction
@ -212,6 +212,7 @@ class ShellState(
}
private fun choosePerson(selected: ShellPerson) {
val fromLaunch = pickerLaunch
person = selected
pickerVisible = false
pickerLaunch = false
@ -223,7 +224,18 @@ class ShellState(
requestsVisible = false
preparePersonMemory()
views[person.key to route] = RememberedView()
onAction(ShellAction.Person(selected))
onAction(ShellAction.Person(selected, fromLaunch))
}
/** A failed switch may reopen only the identity that the integration still has authenticated. */
fun restorePersonPicker(personKey: String, fromLaunch: Boolean) {
person = people.first { it.key == personKey }
preparePersonMemory()
pickerIndex = people.indexOf(person)
gearFocused = false
navFocused = false
pickerLaunch = fromLaunch
pickerVisible = true
}
private fun closePicker() {