fix(notification): open tapped chat at bottom (#984)
Co-authored-by: M57 <41645758+Hy4ri@users.noreply.github.com>
This commit is contained in:
1 parent
19065f02df
commit
ce8fdc45bd
4 files changed
+65
-7
No files matched your search
@@ -44,13 +44,17 @@ fun ChatLifecycleEffects(
|
||||
val lifecycleOwner = LocalLifecycleOwner.current
|
||||
|
||||
// Switch to session from notification/history
|
||||
val pendingSessionId = NavigationController.pendingSessionId
|
||||
LaunchedEffect(sessionId, pendingSessionId, connectionStatus) {
|
||||
val pendingNavigation = NavigationController.pendingChatNavigation
|
||||
LaunchedEffect(sessionId, pendingNavigation, connectionStatus) {
|
||||
if (connectionStatus != ConnectionStatus.CONNECTED) return@LaunchedEffect
|
||||
val target = NavigationController.consumePendingSessionId() ?: sessionId
|
||||
val request = NavigationController.consumePendingChatNavigation()
|
||||
val target = request?.sessionId ?: sessionId
|
||||
if (!target.isNullOrBlank()) {
|
||||
viewModel.switchSession(target)
|
||||
}
|
||||
if (request?.scrollToBottom == true) {
|
||||
scrollController.jumpToBottom(animated = false)
|
||||
}
|
||||
}
|
||||
|
||||
// Land instantly at the bottom on a session switch (issue #682).
|
||||
|
||||
Reference in new issue
Block a user