PacketRead parity: корректные read-статусы и update release notes 1.3.0
Some checks failed
Android Kernel Build / build (push) Failing after 10m41s

This commit is contained in:
2026-03-22 21:25:04 +05:00
parent f915333a44
commit ebb95905b5
3 changed files with 30 additions and 21 deletions

View File

@@ -975,20 +975,24 @@ class MessageRepository private constructor(private val context: Context) {
val readCount =
messageCache[dialogKey]?.value?.count {
it.isFromMe &&
!it.isRead &&
(it.deliveryStatus == DeliveryStatus.DELIVERED ||
it.deliveryStatus == DeliveryStatus.READ)
it.isFromMe && !it.isRead
} ?: 0
messageCache[dialogKey]?.let { flow ->
flow.value =
flow.value.map { msg ->
if (msg.isFromMe &&
!msg.isRead &&
(msg.deliveryStatus == DeliveryStatus.DELIVERED ||
msg.deliveryStatus == DeliveryStatus.READ)
) {
msg.copy(isRead = true, deliveryStatus = DeliveryStatus.READ)
if (msg.isFromMe && !msg.isRead) {
msg.copy(
isRead = true,
deliveryStatus =
if (
msg.deliveryStatus == DeliveryStatus.DELIVERED ||
msg.deliveryStatus == DeliveryStatus.READ
) {
DeliveryStatus.READ
} else {
msg.deliveryStatus
}
)
} else {
msg
}
@@ -1026,20 +1030,24 @@ class MessageRepository private constructor(private val context: Context) {
val readCount =
messageCache[dialogKey]?.value?.count {
it.isFromMe &&
!it.isRead &&
(it.deliveryStatus == DeliveryStatus.DELIVERED ||
it.deliveryStatus == DeliveryStatus.READ)
it.isFromMe && !it.isRead
} ?: 0
messageCache[dialogKey]?.let { flow ->
flow.value =
flow.value.map { msg ->
if (msg.isFromMe &&
!msg.isRead &&
(msg.deliveryStatus == DeliveryStatus.DELIVERED ||
msg.deliveryStatus == DeliveryStatus.READ)
) {
msg.copy(isRead = true, deliveryStatus = DeliveryStatus.READ)
if (msg.isFromMe && !msg.isRead) {
msg.copy(
isRead = true,
deliveryStatus =
if (
msg.deliveryStatus == DeliveryStatus.DELIVERED ||
msg.deliveryStatus == DeliveryStatus.READ
) {
DeliveryStatus.READ
} else {
msg.deliveryStatus
}
)
} else {
msg
}

View File

@@ -22,6 +22,7 @@ object ReleaseNotes {
- Исправлена нормализация дубликатов своих сообщений из sync: локальные WAITING/ERROR теперь автоматически переходят в DELIVERED
- Добавлен watchdog для sync-запроса: если ответ на PacketSync завис, запрос перезапускается автоматически
- Повышена стабильность цикла BATCH_START/BATCH_END/NOT_NEEDED при reconnect
- Исправлена обработка PacketRead: read-статусы теперь ставятся как в desktop/wss, включая сценарии когда read приходит раньше delivery
""".trimIndent()
fun getNotice(version: String): String =

View File

@@ -403,7 +403,7 @@ interface MessageDao {
WHERE account = :account
AND to_public_key = :opponent
AND from_me = 1
AND delivered IN (1, 3)
AND read != 1
"""
)
suspend fun markAllAsRead(account: String, opponent: String): Int