mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-29 20:59:53 +00:00
android, desktop: marking chat read fix (#5658)
* android, desktop: marking chat read fix * comments
This commit is contained in:
parent
41ccb14bfa
commit
c81fa7e6b0
3 changed files with 7 additions and 3 deletions
|
@ -1612,6 +1612,7 @@ public struct ChatStats: Decodable, Hashable {
|
||||||
// actual only via getChats() and getChat(.initial), otherwise, zero
|
// actual only via getChats() and getChat(.initial), otherwise, zero
|
||||||
public var reportsCount: Int = 0
|
public var reportsCount: Int = 0
|
||||||
public var minUnreadItemId: Int64 = 0
|
public var minUnreadItemId: Int64 = 0
|
||||||
|
// actual only via getChats(), otherwise, false
|
||||||
public var unreadChat: Bool = false
|
public var unreadChat: Bool = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1233,10 +1233,11 @@ data class Chat(
|
||||||
@Serializable
|
@Serializable
|
||||||
data class ChatStats(
|
data class ChatStats(
|
||||||
val unreadCount: Int = 0,
|
val unreadCount: Int = 0,
|
||||||
// actual only via getChats() and getChat(.initial), otherwise, zero
|
|
||||||
val unreadMentions: Int = 0,
|
val unreadMentions: Int = 0,
|
||||||
|
// actual only via getChats() and getChat(.initial), otherwise, zero
|
||||||
val reportsCount: Int = 0,
|
val reportsCount: Int = 0,
|
||||||
val minUnreadItemId: Long = 0,
|
val minUnreadItemId: Long = 0,
|
||||||
|
// actual only via getChats(), otherwise, false
|
||||||
val unreadChat: Boolean = false
|
val unreadChat: Boolean = false
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
@ -54,11 +54,13 @@ suspend fun processLoadedChat(
|
||||||
if (contentTag == null) {
|
if (contentTag == null) {
|
||||||
// update main chats, not content tagged
|
// update main chats, not content tagged
|
||||||
withChats {
|
withChats {
|
||||||
if (getChat(chat.id) == null) {
|
val oldChat = getChat(chat.id)
|
||||||
|
if (oldChat == null) {
|
||||||
addChat(chat)
|
addChat(chat)
|
||||||
} else {
|
} else {
|
||||||
updateChatInfo(chat.remoteHostId, chat.chatInfo)
|
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))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue