mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Low power experiments
This commit is contained in:
@@ -15,15 +15,21 @@ func addSynchronizeRecentlyUsedMediaOperation(transaction: Transaction, category
|
||||
}
|
||||
let peerId = PeerId(0)
|
||||
|
||||
var topOperation: (SynchronizeRecentlyUsedMediaOperation, Int32)?
|
||||
var removeOperations: [(SynchronizeRecentlyUsedMediaOperation, Int32)] = []
|
||||
transaction.operationLogEnumerateEntries(peerId: peerId, tag: tag, { entry in
|
||||
if let operation = entry.contents as? SynchronizeRecentlyUsedMediaOperation {
|
||||
topOperation = (operation, entry.tagLocalIndex)
|
||||
if case .sync = operation.content {
|
||||
removeOperations.append((operation, entry.tagLocalIndex))
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
return false
|
||||
})
|
||||
|
||||
if let (topOperation, topLocalIndex) = topOperation, case .sync = topOperation.content {
|
||||
for (_, topLocalIndex) in removeOperations {
|
||||
let _ = transaction.operationLogRemoveEntry(peerId: peerId, tag: tag, tagLocalIndex: topLocalIndex)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user