Refactor SyncCore

This commit is contained in:
Peter
2019-10-21 16:58:00 +04:00
parent 75aa77faa8
commit 10692a323e
1162 changed files with 12205 additions and 10925 deletions

View File

@@ -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
}
}