mobile: fix occasional notifications on sent messages (when sent event arrives before new chat item event) (#2721)

* mobile: fix occasional notifications on sent messages (when sent event arrives before new chat item event)

* fix

* fix condition
This commit is contained in:
Evgeny Poberezkin authored and GitHub committed 2023-07-19 11:59:56 +01:00
1 parent 61334d7b77
commit bf4df9ca58
3 files changed
+11 -8

No files matched your search

@@ -1414,11 +1414,11 @@ object ChatController {
is CR.ChatItemStatusUpdated -> {
val cInfo = r.chatItem.chatInfo
val cItem = r.chatItem.chatItem
if (active(r.user) && !cItem.isDeletedContent && chatModel.upsertChatItem(cInfo, cItem)) {
ntfManager.notifyMessageReceived(r.user, cInfo, cItem)
}
if (!active(r.user) && !cItem.isDeletedContent) {
ntfManager.notifyMessageReceived(r.user, cInfo, cItem)
if (!cItem.isDeletedContent) {
val added = if (active(r.user)) chatModel.upsertChatItem(cInfo, cItem) else true
if (added && cItem.showNotification) {
ntfManager.notifyMessageReceived(r.user, cInfo, cItem)
}
}
}
is CR.ChatItemUpdated ->