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.
53 lines
1.9 KiB
Swift
53 lines
1.9 KiB
Swift
import Foundation
|
|
|
|
final class MutableSynchronizeGroupMessageStatsView: MutablePostboxView {
|
|
fileprivate var groupsAndNamespaces: Set<PeerGroupAndNamespace>
|
|
|
|
init(postbox: PostboxImpl) {
|
|
self.groupsAndNamespaces = postbox.synchronizeGroupMessageStatsTable.get()
|
|
}
|
|
|
|
func replay(postbox: PostboxImpl, transaction: PostboxTransaction) -> Bool {
|
|
var updated = false
|
|
if !transaction.currentUpdatedGroupSummarySynchronizeOperations.isEmpty {
|
|
for (groupIdAndNamespace, value) in transaction.currentUpdatedGroupSummarySynchronizeOperations {
|
|
if value {
|
|
if !self.groupsAndNamespaces.contains(groupIdAndNamespace) {
|
|
self.groupsAndNamespaces.insert(groupIdAndNamespace)
|
|
updated = true
|
|
}
|
|
} else {
|
|
if self.groupsAndNamespaces.contains(groupIdAndNamespace) {
|
|
self.groupsAndNamespaces.remove(groupIdAndNamespace)
|
|
updated = true
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return updated
|
|
}
|
|
|
|
func refreshDueToExternalTransaction(postbox: PostboxImpl) -> Bool {
|
|
/*let groupsAndNamespaces = postbox.synchronizeGroupMessageStatsTable.get()
|
|
if self.groupsAndNamespaces != groupsAndNamespaces {
|
|
self.groupsAndNamespaces = groupsAndNamespaces
|
|
return true
|
|
} else {
|
|
return false
|
|
}*/
|
|
return false
|
|
}
|
|
|
|
func immutableView() -> PostboxView {
|
|
return SynchronizeGroupMessageStatsView(self)
|
|
}
|
|
}
|
|
|
|
public final class SynchronizeGroupMessageStatsView: PostboxView {
|
|
public let groupsAndNamespaces: Set<PeerGroupAndNamespace>
|
|
|
|
init(_ view: MutableSynchronizeGroupMessageStatsView) {
|
|
self.groupsAndNamespaces = view.groupsAndNamespaces
|
|
}
|
|
}
|