mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-26 05:00:48 +00:00

git-subtree-dir: submodules/TelegramCore git-subtree-mainline: 971273e8f8f49a47f14b251d2f35e3445a61fc3f git-subtree-split: 9561227540acef69894e6546395ab223a6233600
42 lines
1.1 KiB
Swift
42 lines
1.1 KiB
Swift
import Foundation
|
|
#if os(macOS)
|
|
import PostboxMac
|
|
#else
|
|
import Postbox
|
|
#endif
|
|
|
|
final class RegularChatState: PeerChatState, Equatable {
|
|
let invalidatedPts: Int32?
|
|
|
|
init(invalidatedPts: Int32?) {
|
|
self.invalidatedPts = invalidatedPts
|
|
}
|
|
|
|
init(decoder: PostboxDecoder) {
|
|
self.invalidatedPts = decoder.decodeOptionalInt32ForKey("ipts")
|
|
}
|
|
|
|
func encode(_ encoder: PostboxEncoder) {
|
|
if let invalidatedPts = self.invalidatedPts {
|
|
encoder.encodeInt32(invalidatedPts, forKey: "ipts")
|
|
} else {
|
|
encoder.encodeNil(forKey: "ipts")
|
|
}
|
|
}
|
|
|
|
func withUpdatedInvalidatedPts(_ invalidatedPts: Int32?) -> RegularChatState {
|
|
return RegularChatState(invalidatedPts: invalidatedPts)
|
|
}
|
|
|
|
func equals(_ other: PeerChatState) -> Bool {
|
|
if let other = other as? RegularChatState, other == self {
|
|
return true
|
|
}
|
|
return false
|
|
}
|
|
|
|
static func ==(lhs: RegularChatState, rhs: RegularChatState) -> Bool {
|
|
return lhs.invalidatedPts == rhs.invalidatedPts
|
|
}
|
|
}
|