Peter 5c1613d104 Add 'submodules/TelegramCore/' from commit '9561227540acef69894e6546395ab223a6233600'
git-subtree-dir: submodules/TelegramCore
git-subtree-mainline: 971273e8f8f49a47f14b251d2f35e3445a61fc3f
git-subtree-split: 9561227540acef69894e6546395ab223a6233600
2019-06-11 18:59:08 +01:00

35 lines
928 B
Swift

import Foundation
#if os(macOS)
import PostboxMac
#else
import Postbox
#endif
public struct ContactsSettings: Equatable, PreferencesEntry {
public var synchronizeContacts: Bool
public static var defaultSettings: ContactsSettings {
return ContactsSettings(synchronizeContacts: true)
}
public init(synchronizeContacts: Bool) {
self.synchronizeContacts = synchronizeContacts
}
public init(decoder: PostboxDecoder) {
self.synchronizeContacts = decoder.decodeInt32ForKey("synchronizeContacts", orElse: 0) != 0
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.synchronizeContacts ? 1 : 0, forKey: "synchronizeContacts")
}
public func isEqual(to: PreferencesEntry) -> Bool {
if let to = to as? ContactsSettings {
return self == to
} else {
return false
}
}
}