Files
GLEGram-iOS/submodules/Postbox/Sources/MessageHistorySavedMessagesStatsView.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

56 lines
1.6 KiB
Swift

import Foundation
final class MutableMessageHistorySavedMessagesStatsView: MutablePostboxView {
fileprivate let peerId: PeerId
fileprivate var count: Int = 0
fileprivate var isLoading: Bool = false
init(postbox: PostboxImpl, peerId: PeerId) {
self.peerId = peerId
self.reload(postbox: postbox)
}
private func reload(postbox: PostboxImpl) {
let validIndexBoundary = postbox.peerThreadCombinedStateTable.get(peerId: peerId)?.validIndexBoundary
self.isLoading = validIndexBoundary == nil
if !self.isLoading {
self.count = postbox.messageHistoryThreadIndexTable.getCount(peerId: self.peerId)
} else {
self.count = 0
}
}
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
var updated = false
if transaction.updatedMessageThreadPeerIds.contains(self.peerId) {
self.reload(postbox: postbox)
updated = true
}
return updated
}
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
self.reload(postbox: postbox)
return true
}
func immutableView() -> PostboxView {
return MessageHistorySavedMessagesStatsView(self)
}
}
public final class MessageHistorySavedMessagesStatsView: PostboxView {
public let isLoading: Bool
public let count: Int
init(_ view: MutableMessageHistorySavedMessagesStatsView) {
self.isLoading = view.isLoading
self.count = view.count
}
}