Swiftgram/submodules/TelegramCore/Sources/SynchronizeLocalizationUpdatesOperation.swift
2019-11-01 17:11:12 +04:00

23 lines
806 B
Swift

import Foundation
import Postbox
import SwiftSignalKit
import SyncCore
func addSynchronizeLocalizationUpdatesOperation(transaction: Transaction) {
let tag: PeerOperationLogTag = OperationLogTags.SynchronizeLocalizationUpdates
let peerId = PeerId(namespace: 0, id: 0)
var topLocalIndex: Int32?
transaction.operationLogEnumerateEntries(peerId: peerId, tag: tag, { entry in
topLocalIndex = entry.tagLocalIndex
return false
})
if let topLocalIndex = topLocalIndex {
let _ = transaction.operationLogRemoveEntry(peerId: peerId, tag: tag, tagLocalIndex: topLocalIndex)
}
transaction.operationLogAddEntry(peerId: peerId, tag: tag, tagLocalIndex: .automatic, tagMergedIndex: .automatic, contents: SynchronizeLocalizationUpdatesOperation())
}