mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-08 08:31:13 +00:00

git-subtree-dir: submodules/TelegramCore git-subtree-mainline: 971273e8f8f49a47f14b251d2f35e3445a61fc3f git-subtree-split: 9561227540acef69894e6546395ab223a6233600
37 lines
1.0 KiB
Swift
37 lines
1.0 KiB
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
import SwiftSignalKitMac
|
|
#else
|
|
import Postbox
|
|
import SwiftSignalKit
|
|
#endif
|
|
|
|
final class SynchronizeLocalizationUpdatesOperation: PostboxCoding {
|
|
init() {
|
|
}
|
|
|
|
init(decoder: PostboxDecoder) {
|
|
}
|
|
|
|
func encode(_ encoder: PostboxEncoder) {
|
|
}
|
|
}
|
|
|
|
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())
|
|
}
|