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
2023-07-19 11:59:56 +01:00
committed by GitHub
parent 61334d7b77
commit bf4df9ca58
3 changed files with 11 additions and 8 deletions
+5 -2
View File
@@ -1326,8 +1326,11 @@ func processReceivedMsg(_ res: ChatResponse) async {
case let .chatItemStatusUpdated(user, aChatItem):
let cInfo = aChatItem.chatInfo
let cItem = aChatItem.chatItem
if !cItem.isDeletedContent && (!active(user) || m.upsertChatItem(cInfo, cItem)) {
NtfManager.shared.notifyMessageReceived(user, cInfo, cItem)
if !cItem.isDeletedContent {
let added = active(user) ? m.upsertChatItem(cInfo, cItem) : true
if added && cItem.showNotification {
NtfManager.shared.notifyMessageReceived(user, cInfo, cItem)
}
}
if let endTask = m.messageDelivery[cItem.id] {
switch cItem.meta.itemStatus {