mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-30 09:21:28 +00:00
no message
This commit is contained in:
parent
b5f298977c
commit
9f89633d03
@ -293,6 +293,11 @@ final class MessageHistoryTable: Table {
|
||||
}
|
||||
}
|
||||
|
||||
func clearHistory(peerId: PeerId, operationsByPeerId: inout [PeerId: [MessageHistoryOperation]], unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], updatedPeerReadStateOperations: inout [PeerId: PeerReadStateSynchronizationOperation?]) {
|
||||
let indices = self.allIndices(peerId)
|
||||
self.removeMessages(indices.map { $0.id }, operationsByPeerId: &operationsByPeerId, unsentMessageOperations: &unsentMessageOperations, updatedPeerReadStateOperations: &updatedPeerReadStateOperations)
|
||||
}
|
||||
|
||||
func fillHole(_ id: MessageId, fillType: HoleFill, tagMask: MessageTags?, messages: [StoreMessage], operationsByPeerId: inout [PeerId: [MessageHistoryOperation]], unsentMessageOperations: inout [IntermediateMessageHistoryUnsentOperation], updatedPeerReadStateOperations: inout [PeerId: PeerReadStateSynchronizationOperation?]) {
|
||||
var operations: [MessageHistoryIndexOperation] = []
|
||||
self.messageHistoryIndexTable.fillHole(id, fillType: fillType, tagMask: tagMask, messages: self.internalStoreMessages(messages), operations: &operations)
|
||||
@ -1669,6 +1674,16 @@ final class MessageHistoryTable: Table {
|
||||
|
||||
return messageIds
|
||||
}
|
||||
|
||||
func allIndices(_ peerId: PeerId) -> [MessageIndex] {
|
||||
var indices: [MessageIndex] = []
|
||||
self.valueBox.range(self.table, start: self.key(MessageIndex.lowerBound(peerId: peerId)).predecessor, end: self.key(MessageIndex.upperBound(peerId: peerId)).successor, keys: { key in
|
||||
let index = MessageIndex(id: MessageId(peerId: PeerId(key.getInt64(0)), namespace: key.getInt32(8 + 4), id: key.getInt32(8 + 4 + 4)), timestamp: key.getInt32(8))
|
||||
indices.append(index)
|
||||
return true
|
||||
}, limit: 0)
|
||||
return indices
|
||||
}
|
||||
|
||||
func debugList(_ peerId: PeerId, peerTable: PeerTable) -> [RenderedMessageHistoryEntry] {
|
||||
var operationsByPeerId: [PeerId : [MessageHistoryOperation]] = [:]
|
||||
|
@ -47,6 +47,10 @@ public final class Modifier {
|
||||
self.postbox?.deleteMessages(messageIds)
|
||||
}
|
||||
|
||||
public func clearHistory(_ peerId: PeerId) {
|
||||
self.postbox?.clearHistory(peerId)
|
||||
}
|
||||
|
||||
public func deleteMessagesWithGlobalIds(_ ids: [Int32]) {
|
||||
if let postbox = self.postbox {
|
||||
let messageIds = postbox.messageIdsForGlobalIds(ids)
|
||||
@ -753,6 +757,10 @@ public final class Postbox {
|
||||
self.messageHistoryTable.removeMessages(messageIds, operationsByPeerId: &self.currentOperationsByPeerId, unsentMessageOperations: ¤tUnsentOperations, updatedPeerReadStateOperations: &self.currentUpdatedSynchronizeReadStateOperations)
|
||||
}
|
||||
|
||||
fileprivate func clearHistory(_ peerId: PeerId) {
|
||||
self.messageHistoryTable.clearHistory(peerId: peerId, operationsByPeerId: &self.currentOperationsByPeerId, unsentMessageOperations: ¤tUnsentOperations, updatedPeerReadStateOperations: &self.currentUpdatedSynchronizeReadStateOperations)
|
||||
}
|
||||
|
||||
fileprivate func resetIncomingReadStates(_ states: [PeerId: [MessageId.Namespace: PeerReadState]]) {
|
||||
self.messageHistoryTable.resetIncomingReadStates(states, operationsByPeerId: &self.currentOperationsByPeerId, updatedPeerReadStateOperations: &self.currentUpdatedSynchronizeReadStateOperations)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user