Refactoring

This commit is contained in:
Ali
2021-04-18 03:10:18 +04:00
parent 4637ed672e
commit 60d959bff8
93 changed files with 221 additions and 191 deletions

View File

@@ -0,0 +1,22 @@
import Foundation
import Postbox
import SwiftSignalKit
import SyncCore
func addSynchronizeLocalizationUpdatesOperation(transaction: Transaction) {
let tag: PeerOperationLogTag = OperationLogTags.SynchronizeLocalizationUpdates
let peerId = PeerId(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())
}