Co-authored-by: M57 <hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
ae62b05e6d
commit
f5edf1569c
4 files changed
+28
-9
No files matched your search
@@ -101,6 +101,7 @@ import com.m57.hermescontrol.ui.common.HermesScaffold
|
||||
fun ChatScreen(
|
||||
modifier: Modifier = Modifier,
|
||||
onOpenDrawer: (() -> Unit)? = null,
|
||||
sessionId: String? = null,
|
||||
viewModel: ChatViewModel = viewModel(),
|
||||
) {
|
||||
val state by viewModel.uiState.collectAsStateWithLifecycle()
|
||||
@@ -111,6 +112,14 @@ fun ChatScreen(
|
||||
val context = LocalContext.current
|
||||
val lifecycleOwner = androidx.lifecycle.compose.LocalLifecycleOwner.current
|
||||
|
||||
// Switch to the session from a notification tap when provided.
|
||||
// Runs once per sessionId value (re-runs if a different notification taps in).
|
||||
LaunchedEffect(sessionId) {
|
||||
if (!sessionId.isNullOrBlank()) {
|
||||
viewModel.switchSession(sessionId)
|
||||
}
|
||||
}
|
||||
|
||||
// Manage notification foreground service lifecycle:
|
||||
// - When app goes to background (ON_STOP), mark as not-foreground and
|
||||
// start the notification service so we can post reply notifications.
|
||||
|
||||
Reference in new issue
Block a user