fix(#240): parse session_id from params root (#242)

* fix(#240): parse session_id from params root

Allows correct session mapping when opening app via notification.

* fix(#240): set MainActivity launchMode to singleTop

Prevents activity destruction and WebSocket reconnection when tapping notifications.

* fix(#240): save inline notification replies to Room database

* fix(#240): refresh current session when app comes to foreground

* fix(#240): use uppercase role string to match Mapper mapping expectations

* style: format NotificationReplyReceiver.kt to satisfy ktlint
This commit is contained in:
M57 authored and GitHub committed 2026-06-21 19:04:54 +03:00
1 parent d7ca7b084e
commit bfef3613fa
6 files changed
+60 -1

No files matched your search

@@ -86,6 +86,29 @@ class EventParserTest {
assertEquals("session-1", tokenEvent.sessionId)
}
@Test
fun testParseMessageToken_withSessionIdInParams_returnsMessageTokenEvent() {
val response =
JsonRpcResponse(
jsonrpc = "2.0",
id = null,
result = null,
error = null,
method = "event",
params =
mapOf(
"type" to "message.token",
"session_id" to "session-params-1",
"payload" to mapOf("text" to "hello"),
),
)
val event = EventParser.parse(response)
assertTrue(event is WsEvent.MessageToken)
val tokenEvent = event as WsEvent.MessageToken
assertEquals("hello", tokenEvent.token)
assertEquals("session-params-1", tokenEvent.sessionId)
}
@Test
fun testParseThinkingDelta_returnsThinkingDeltaEvent() {
val response =