mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-19 12:10:55 +00:00
32 lines
826 B
Swift
32 lines
826 B
Swift
import Foundation
|
|
|
|
final class MutableNoticeEntryView: MutablePostboxView {
|
|
private let key: NoticeEntryKey
|
|
fileprivate var value: NoticeEntry?
|
|
|
|
init(postbox: Postbox, key: NoticeEntryKey) {
|
|
self.key = key
|
|
self.value = postbox.noticeTable.get(key: key)
|
|
}
|
|
|
|
func replay(postbox: Postbox, transaction: PostboxTransaction) -> Bool {
|
|
if transaction.updatedNoticeEntryKeys.contains(self.key) {
|
|
self.value = postbox.noticeTable.get(key: key)
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
func immutableView() -> PostboxView {
|
|
return NoticeEntryView(self)
|
|
}
|
|
}
|
|
|
|
public final class NoticeEntryView: PostboxView {
|
|
public let value: NoticeEntry?
|
|
|
|
init(_ view: MutableNoticeEntryView) {
|
|
self.value = view.value
|
|
}
|
|
}
|