mirror of
https://github.com/ichmagmaus111/ghostgram.git
synced 2026-04-24 08:36:07 +02:00
db53826061
- Migrated project to latest Telegram iOS base (v12.3.2+) - Fixed circular dependency between GhostModeManager and MiscSettingsManager - Fixed multiple Bazel build configuration errors (select() default conditions) - Fixed duplicate type definitions in PeerInfoScreen - Fixed swiftmodule directory resolution in build scripts - Added Ghostgram Settings tab in main Settings menu with all 5 features - Cleared sensitive credentials from config.json (template-only now) - Excluded bazel-cache from version control
52 lines
1.5 KiB
Swift
52 lines
1.5 KiB
Swift
import Foundation
|
|
|
|
final class MutableDeletedMessagesView: MutablePostboxView {
|
|
let peerId: PeerId
|
|
var currentDeletedMessages: [MessageId] = []
|
|
|
|
init(peerId: PeerId) {
|
|
self.peerId = peerId
|
|
}
|
|
|
|
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
|
|
var updated = false
|
|
if let operations = transaction.currentOperationsByPeerId[self.peerId] {
|
|
var testMessageIds: [MessageId] = []
|
|
for operation in operations {
|
|
switch operation {
|
|
case let .Remove(indices):
|
|
for (index, _, _) in indices {
|
|
testMessageIds.append(index.id)
|
|
}
|
|
default:
|
|
break
|
|
}
|
|
}
|
|
self.currentDeletedMessages.removeAll()
|
|
for id in testMessageIds {
|
|
if !postbox.messageHistoryIndexTable.exists(id) {
|
|
self.currentDeletedMessages.append(id)
|
|
updated = true
|
|
}
|
|
}
|
|
}
|
|
return updated
|
|
}
|
|
|
|
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
|
|
return false
|
|
}
|
|
|
|
func immutableView() -> PostboxView {
|
|
return DeletedMessagesView(self)
|
|
}
|
|
}
|
|
|
|
public final class DeletedMessagesView: PostboxView {
|
|
public let currentDeletedMessages: [MessageId]
|
|
|
|
init(_ view: MutableDeletedMessagesView) {
|
|
self.currentDeletedMessages = view.currentDeletedMessages
|
|
}
|
|
}
|