Files
GLEGram-iOS/submodules/Postbox/Sources/StoryView.swift
T
Leeksov 4647310322 GLEGram 12.5 — Initial public release
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.
2026-04-06 09:48:12 +03:00

53 lines
1.3 KiB
Swift

import Foundation
final class MutableStoryView: MutablePostboxView {
let id: StoryId
var item: CodableEntry?
init(postbox: PostboxImpl, id: StoryId) {
self.id = id
self.item = postbox.storyTable.get(id: self.id)
}
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
var updated = false
for event in transaction.storyEvents {
switch event {
case .updated(self.id):
let item = postbox.storyTable.get(id: self.id)
if self.item != item {
self.item = item
updated = true
}
default:
break
}
}
return updated
}
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
let item = postbox.storyTable.get(id: self.id)
if self.item != item {
self.item = item
return true
} else {
return false
}
}
func immutableView() -> PostboxView {
return StoryView(self)
}
}
public final class StoryView: PostboxView {
public let item: CodableEntry?
init(_ view: MutableStoryView) {
self.item = view.item
}
}