fix(notification): disconnect idle background socket (#858)
* fix(notification): disconnect idle background socket * fix(notification): clear rejected prompt state
This commit is contained in:
1 parent
0db741edfe
commit
3b033a025b
8 files changed
+221
-40
No files matched your search
@@ -1270,6 +1270,7 @@ class ChatViewModel(
|
||||
// in-flight turn via session.redirect instead of queueing a fresh
|
||||
// prompt.submit. The backend rewrites the live turn when it can, or
|
||||
// queues the correction as the next turn otherwise (issue #710).
|
||||
ActiveSessionHolder.set(agentSessionId, storageSessionId)
|
||||
if (wasStreaming && attachments.isEmpty()) {
|
||||
wsClient.sendRedirect(
|
||||
agentSessionId,
|
||||
|
||||
@@ -17,7 +17,6 @@ import androidx.lifecycle.LifecycleEventObserver
|
||||
import androidx.lifecycle.compose.LocalLifecycleOwner
|
||||
import com.m57.hermescontrol.NavigationController
|
||||
import com.m57.hermescontrol.data.ws.ConnectionStatus
|
||||
import com.m57.hermescontrol.notification.NotificationHelper
|
||||
import com.m57.hermescontrol.ui.chat.ChatMessage
|
||||
import com.m57.hermescontrol.ui.chat.ChatViewModel
|
||||
import com.m57.hermescontrol.ui.chat.ClarifyUi
|
||||
@@ -64,23 +63,16 @@ fun ChatLifecycleEffects(
|
||||
}
|
||||
}
|
||||
|
||||
// Lifecycle observer for notification foreground service
|
||||
// Refresh chat state when the app returns to the foreground.
|
||||
DisposableEffect(lifecycleOwner) {
|
||||
val observer =
|
||||
LifecycleEventObserver { _, event ->
|
||||
when (event) {
|
||||
Lifecycle.Event.ON_START -> {
|
||||
NotificationHelper.setAppForeground(context, true)
|
||||
NotificationHelper.stop(context)
|
||||
viewModel.refreshSettings()
|
||||
viewModel.refreshCurrentSession()
|
||||
}
|
||||
|
||||
Lifecycle.Event.ON_STOP -> {
|
||||
NotificationHelper.setAppForeground(context, false)
|
||||
NotificationHelper.start(context)
|
||||
}
|
||||
|
||||
else -> {}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user