mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Refactor SyncCore
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
import Foundation
|
||||
#if os(macOS)
|
||||
import PostboxMac
|
||||
#else
|
||||
import Postbox
|
||||
#endif
|
||||
|
||||
public enum AccountEnvironment: Int32 {
|
||||
case production = 0
|
||||
case test = 1
|
||||
}
|
||||
|
||||
public final class AccountEnvironmentAttribute: AccountRecordAttribute {
|
||||
public let environment: AccountEnvironment
|
||||
|
||||
public init(environment: AccountEnvironment) {
|
||||
self.environment = environment
|
||||
}
|
||||
|
||||
public init(decoder: PostboxDecoder) {
|
||||
self.environment = AccountEnvironment(rawValue: decoder.decodeInt32ForKey("environment", orElse: 0)) ?? .production
|
||||
}
|
||||
|
||||
public func encode(_ encoder: PostboxEncoder) {
|
||||
encoder.encodeInt32(self.environment.rawValue, forKey: "environment")
|
||||
}
|
||||
|
||||
public func isEqual(to: AccountRecordAttribute) -> Bool {
|
||||
guard let to = to as? AccountEnvironmentAttribute else {
|
||||
return false
|
||||
}
|
||||
if self.environment != to.environment {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user