mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2026-04-27 02:05:48 +00:00
android, desktop: marking chat read fix (#5658)
* android, desktop: marking chat read fix * comments
This commit is contained in:
committed by
GitHub
parent
41ccb14bfa
commit
c81fa7e6b0
@@ -1612,6 +1612,7 @@ public struct ChatStats: Decodable, Hashable {
|
||||
// actual only via getChats() and getChat(.initial), otherwise, zero
|
||||
public var reportsCount: Int = 0
|
||||
public var minUnreadItemId: Int64 = 0
|
||||
// actual only via getChats(), otherwise, false
|
||||
public var unreadChat: Bool = false
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -1233,10 +1233,11 @@ data class Chat(
|
||||
@Serializable
|
||||
data class ChatStats(
|
||||
val unreadCount: Int = 0,
|
||||
// actual only via getChats() and getChat(.initial), otherwise, zero
|
||||
val unreadMentions: Int = 0,
|
||||
// actual only via getChats() and getChat(.initial), otherwise, zero
|
||||
val reportsCount: Int = 0,
|
||||
val minUnreadItemId: Long = 0,
|
||||
// actual only via getChats(), otherwise, false
|
||||
val unreadChat: Boolean = false
|
||||
)
|
||||
|
||||
|
||||
+4
-2
@@ -54,11 +54,13 @@ suspend fun processLoadedChat(
|
||||
if (contentTag == null) {
|
||||
// update main chats, not content tagged
|
||||
withChats {
|
||||
if (getChat(chat.id) == null) {
|
||||
val oldChat = getChat(chat.id)
|
||||
if (oldChat == null) {
|
||||
addChat(chat)
|
||||
} else {
|
||||
updateChatInfo(chat.remoteHostId, chat.chatInfo)
|
||||
updateChatStats(chat.remoteHostId, chat.id, chat.chatStats)
|
||||
// unreadChat is currently not actual in getChat query (always false)
|
||||
updateChatStats(chat.remoteHostId, chat.id, chat.chatStats.copy(unreadChat = oldChat.chatStats.unreadChat))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user