mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
32 lines
896 B
Swift
32 lines
896 B
Swift
import Foundation
|
|
import Postbox
|
|
|
|
|
|
public struct SecretChatSettings: Equatable, PreferencesEntry {
|
|
public private(set) var acceptOnThisDevice: Bool
|
|
|
|
public static var defaultSettings: SecretChatSettings {
|
|
return SecretChatSettings(acceptOnThisDevice: true)
|
|
}
|
|
|
|
public init(acceptOnThisDevice: Bool) {
|
|
self.acceptOnThisDevice = acceptOnThisDevice
|
|
}
|
|
|
|
public init(decoder: PostboxDecoder) {
|
|
self.acceptOnThisDevice = decoder.decodeInt32ForKey("acceptOnThisDevice", orElse: 1) != 0
|
|
}
|
|
|
|
public func encode(_ encoder: PostboxEncoder) {
|
|
encoder.encodeInt32(self.acceptOnThisDevice ? 1 : 0, forKey: "acceptOnThisDevice")
|
|
}
|
|
|
|
public func isEqual(to: PreferencesEntry) -> Bool {
|
|
if let to = to as? SecretChatSettings {
|
|
return self == to
|
|
} else {
|
|
return false
|
|
}
|
|
}
|
|
}
|