android: add mention override for muted chat notifications
Some checks failed
CI / test (push) Failing after 2m18s
Some checks failed
CI / test (push) Failing after 2m18s
This commit is contained in:
@@ -141,6 +141,10 @@ class NetworkChatRepositoryTest {
|
||||
return chats.value.firstOrNull { it.id == chatId }?.displayTitle
|
||||
}
|
||||
|
||||
override suspend fun isChatMuted(chatId: Long): Boolean? {
|
||||
return chats.value.firstOrNull { it.id == chatId }?.muted
|
||||
}
|
||||
|
||||
override suspend fun upsertChats(chats: List<ChatEntity>) {
|
||||
val merged = this.chats.value.associateBy { it.id }.toMutableMap()
|
||||
chats.forEach { merged[it.id] = it }
|
||||
|
||||
@@ -2,6 +2,7 @@ package ru.daemonlord.messenger.data.realtime
|
||||
|
||||
import kotlinx.serialization.json.Json
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import ru.daemonlord.messenger.domain.realtime.model.RealtimeEvent
|
||||
@@ -70,6 +71,33 @@ class RealtimeEventParserTest {
|
||||
assertEquals(5L, mapped.senderId)
|
||||
assertEquals(100L, mapped.replyToMessageId)
|
||||
assertEquals("hi", mapped.text)
|
||||
assertFalse(mapped.isMention)
|
||||
}
|
||||
|
||||
@Test
|
||||
fun parseReceiveMessage_withMentionFlag_mapsMention() {
|
||||
val payload = """
|
||||
{
|
||||
"event": "receive_message",
|
||||
"payload": {
|
||||
"chat_id": 88,
|
||||
"message": {
|
||||
"id": 9002,
|
||||
"chat_id": 88,
|
||||
"sender_id": 5,
|
||||
"type": "text",
|
||||
"text": "@you hi",
|
||||
"created_at": "2026-03-08T12:00:00Z",
|
||||
"is_mention": true
|
||||
}
|
||||
}
|
||||
}
|
||||
""".trimIndent()
|
||||
|
||||
val event = parser.parse(payload)
|
||||
assertTrue(event is RealtimeEvent.ReceiveMessage)
|
||||
val mapped = event as RealtimeEvent.ReceiveMessage
|
||||
assertTrue(mapped.isMention)
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user