Files
ghostgram/submodules/Postbox/Sources/DeletedMessagesView.swift
ichmagmaus 812 db53826061 chore: migrate to new version + fixed several critical bugs
- 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
2026-02-23 23:04:32 +01:00

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
}
}