mirror of
https://github.com/GLEGram/GLEGram-iOS.git
synced 2026-04-25 12:26:55 +02:00
4647310322
Based on Swiftgram 12.5 (Telegram iOS 12.5). All GLEGram features ported and organized in GLEGram/ folder. Features: Ghost Mode, Saved Deleted Messages, Content Protection Bypass, Font Replacement, Fake Profile, Chat Export, Plugin System, and more. See CHANGELOG_12.5.md for full details.
49 lines
1.3 KiB
Swift
49 lines
1.3 KiB
Swift
import Foundation
|
|
|
|
final class MutableChatInterfaceStateView: MutablePostboxView {
|
|
fileprivate let peerId: PeerId
|
|
fileprivate var value: StoredPeerChatInterfaceState?
|
|
|
|
init(postbox: PostboxImpl, peerId: PeerId) {
|
|
self.peerId = peerId
|
|
|
|
self.reload(postbox: postbox)
|
|
}
|
|
|
|
private func reload(postbox: PostboxImpl) {
|
|
self.value = postbox.peerChatInterfaceStateTable.get(self.peerId)
|
|
}
|
|
|
|
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
|
|
var updated = false
|
|
|
|
if transaction.currentUpdatedPeerChatListEmbeddedStates.contains(self.peerId) {
|
|
let previousValue = self.value
|
|
self.reload(postbox: postbox)
|
|
if previousValue != self.value {
|
|
updated = true
|
|
}
|
|
}
|
|
|
|
return updated
|
|
}
|
|
|
|
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
|
|
self.reload(postbox: postbox)
|
|
|
|
return true
|
|
}
|
|
|
|
func immutableView() -> PostboxView {
|
|
return ChatInterfaceStateView(self)
|
|
}
|
|
}
|
|
|
|
public final class ChatInterfaceStateView: PostboxView {
|
|
public let value: StoredPeerChatInterfaceState?
|
|
|
|
init(_ view: MutableChatInterfaceStateView) {
|
|
self.value = view.value
|
|
}
|
|
}
|