mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
[Workaround] Force clear time based attributes for deleted messages
This commit is contained in:
@@ -1096,6 +1096,11 @@ public final class Transaction {
|
||||
assert(!self.disposed)
|
||||
return self.postbox?.searchPeers(query: query) ?? []
|
||||
}
|
||||
|
||||
public func clearTimestampBasedAttribute(id: MessageId, tag: UInt16) {
|
||||
assert(!self.disposed)
|
||||
self.postbox?.clearTimestampBasedAttribute(id: id, tag: tag)
|
||||
}
|
||||
}
|
||||
|
||||
public enum PostboxResult {
|
||||
@@ -3566,6 +3571,10 @@ public final class Postbox {
|
||||
}
|
||||
}
|
||||
|
||||
fileprivate func clearTimestampBasedAttribute(id: MessageId, tag: UInt16) {
|
||||
self.timestampBasedMessageAttributesTable.remove(tag: tag, id: id, operations: &self.currentTimestampBasedMessageAttributesOperations)
|
||||
}
|
||||
|
||||
fileprivate func reindexUnreadCounters() {
|
||||
self.groupMessageStatsTable.removeAll()
|
||||
let _ = CFAbsoluteTimeGetCurrent()
|
||||
|
||||
@@ -65,7 +65,9 @@ func managedAutoremoveMessageOperations(network: Network, postbox: Postbox, isRe
|
||||
|
||||
Logger.shared.log("Autoremove", "starting isRemove: \(isRemove)")
|
||||
|
||||
let disposable = combineLatest(timeOffset, postbox.timestampBasedMessageAttributesView(tag: isRemove ? 0 : 1)).start(next: { timeOffset, view in
|
||||
let tag: UInt16 = isRemove ? 0 : 1
|
||||
|
||||
let disposable = combineLatest(timeOffset, postbox.timestampBasedMessageAttributesView(tag: tag)).start(next: { timeOffset, view in
|
||||
let (disposeOperations, beginOperations) = helper.with { helper -> (disposeOperations: [Disposable], beginOperations: [(TimestampBasedMessageAttributesEntry, MetaDisposable)]) in
|
||||
return helper.update(view.head)
|
||||
}
|
||||
@@ -111,6 +113,7 @@ func managedAutoremoveMessageOperations(network: Network, postbox: Postbox, isRe
|
||||
})
|
||||
}
|
||||
} else {
|
||||
transaction.clearTimestampBasedAttribute(id: entry.messageId, tag: tag)
|
||||
Logger.shared.log("Autoremove", "No message to autoremove for \(entry.messageId)")
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user