diff --git a/submodules/Postbox/Sources/MessageHistoryTagsSummaryTable.swift b/submodules/Postbox/Sources/MessageHistoryTagsSummaryTable.swift index 8ae38715f2..6dc49b60e9 100644 --- a/submodules/Postbox/Sources/MessageHistoryTagsSummaryTable.swift +++ b/submodules/Postbox/Sources/MessageHistoryTagsSummaryTable.swift @@ -110,6 +110,9 @@ class MessageHistoryTagsSummaryTable: Table { private func set(_ key: MessageHistoryTagsSummaryKey, summary: MessageHistoryTagNamespaceSummary, updatedSummaries: inout [MessageHistoryTagsSummaryKey: MessageHistoryTagNamespaceSummary]) { if self.get(key) != summary { + if key.tag.rawValue == 2048 { + postboxLog("[MessageHistoryTagsSummaryTable] set \(key.tag.rawValue) for \(key.peerId) to \(summary.count)") + } self.updatedKeys.insert(key) self.cachedSummaries[key] = CachedEntry(summary: summary) updatedSummaries[key] = summary diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift index dc8c8ac356..f45b440830 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/TelegramEngineMessages.swift @@ -155,11 +155,35 @@ public extension TelegramEngine { } public func earliestUnseenPersonalMentionMessage(peerId: PeerId) -> Signal { + let account = self.account return _internal_earliestUnseenPersonalMentionMessage(account: self.account, peerId: peerId) + |> mapToSignal { result -> Signal in + switch result { + case .loading: + return .single(result) + case let .result(messageId): + if messageId == nil { + let _ = clearPeerUnseenPersonalMessagesInteractively(account: account, peerId: peerId).start() + } + return .single(result) + } + } } public func earliestUnseenPersonalReactionMessage(peerId: PeerId) -> Signal { + let account = self.account return _internal_earliestUnseenPersonalReactionMessage(account: self.account, peerId: peerId) + |> mapToSignal { result -> Signal in + switch result { + case .loading: + return .single(result) + case let .result(messageId): + if messageId == nil { + let _ = clearPeerUnseenReactionsInteractively(account: account, peerId: peerId).start() + } + return .single(result) + } + } } public func exportMessageLink(peerId: PeerId, messageId: MessageId, isThread: Bool = false) -> Signal {