mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Refactor SyncCore
This commit is contained in:
43
submodules/SyncCore/Sources/VoipConfiguration.swift
Normal file
43
submodules/SyncCore/Sources/VoipConfiguration.swift
Normal file
@@ -0,0 +1,43 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
#else
|
||||
import Postbox
|
||||
#endif
|
||||
|
||||
public enum VoiceCallP2PMode: Int32 {
|
||||
case never = 0
|
||||
case contacts = 1
|
||||
case always = 2
|
||||
}
|
||||
|
||||
public struct VoipConfiguration: PreferencesEntry, Equatable {
|
||||
public var serializedData: String?
|
||||
|
||||
public static var defaultValue: VoipConfiguration {
|
||||
return VoipConfiguration(serializedData: nil)
|
||||
}
|
||||
|
||||
init(serializedData: String?) {
|
||||
self.serializedData = serializedData
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.serializedData = decoder.decodeOptionalStringForKey("serializedData")
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
if let serializedData = self.serializedData {
|
||||
encoder.encodeString(serializedData, forKey: "serializedData")
|
||||
} else {
|
||||
encoder.encodeNil(forKey: "serializedData")
|
||||
}
|
||||
}
|
||||
|
||||
public func isEqual(to: PreferencesEntry) -> Bool {
|
||||
guard let to = to as? VoipConfiguration else {
|
||||
return false
|
||||
}
|
||||
return self == to
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user