mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
Reactions update [skip ci]
This commit is contained in:
@@ -2,7 +2,6 @@ import Foundation
|
||||
import Postbox
|
||||
import SwiftSignalKit
|
||||
|
||||
|
||||
func addSynchronizeMarkAllUnseenPersonalMessagesOperation(transaction: Transaction, peerId: PeerId, maxId: MessageId.Id) {
|
||||
let tag: PeerOperationLogTag = OperationLogTags.SynchronizeMarkAllUnseenPersonalMessages
|
||||
|
||||
@@ -25,3 +24,25 @@ func addSynchronizeMarkAllUnseenPersonalMessagesOperation(transaction: Transacti
|
||||
|
||||
transaction.operationLogAddEntry(peerId: peerId, tag: tag, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: SynchronizeMarkAllUnseenPersonalMessagesOperation(maxId: maxId))
|
||||
}
|
||||
|
||||
func addSynchronizeMarkAllUnseenReactionsOperation(transaction: Transaction, peerId: PeerId, maxId: MessageId.Id) {
|
||||
let tag: PeerOperationLogTag = OperationLogTags.SynchronizeMarkAllUnseenReactions
|
||||
var topLocalIndex: Int32?
|
||||
var currentMaxId: MessageId.Id?
|
||||
transaction.operationLogEnumerateEntries(peerId: peerId, tag: tag, { entry in
|
||||
topLocalIndex = entry.tagLocalIndex
|
||||
if let operation = entry.contents as? SynchronizeMarkAllUnseenReactionsOperation {
|
||||
currentMaxId = operation.maxId
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
if let topLocalIndex = topLocalIndex {
|
||||
if let currentMaxId = currentMaxId, currentMaxId >= maxId {
|
||||
return
|
||||
}
|
||||
let _ = transaction.operationLogRemoveEntry(peerId: peerId, tag: tag, tagLocalIndex: topLocalIndex)
|
||||
}
|
||||
|
||||
transaction.operationLogAddEntry(peerId: peerId, tag: tag, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: SynchronizeMarkAllUnseenReactionsOperation(maxId: maxId))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user