|
|
@ -47,7 +47,7 @@ class DataStore: NSObject { |
|
|
|
setupSyncNotification() |
|
|
|
setupSyncNotification() |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
func setupSyncNotification() { |
|
|
|
func setupSyncNotification() { |
|
|
|
if shouldDisplay(.sync) { |
|
|
|
if shouldDisplay(.sync) { |
|
|
|
ubiquitousStore = NSUbiquitousKeyValueStore.default |
|
|
|
ubiquitousStore = NSUbiquitousKeyValueStore.default |
|
|
|
NotificationCenter.default.addObserver(self, |
|
|
|
NotificationCenter.default.addObserver(self, |
|
|
@ -72,6 +72,8 @@ class DataStore: NSObject { |
|
|
|
if cloudTimezones != currentTimezones { |
|
|
|
if cloudTimezones != currentTimezones { |
|
|
|
Logger.info("Syncing local timezones with data from the ☁️") |
|
|
|
Logger.info("Syncing local timezones with data from the ☁️") |
|
|
|
userDefaults.set(cloudTimezones, forKey: CLDefaultPreferenceKey) |
|
|
|
userDefaults.set(cloudTimezones, forKey: CLDefaultPreferenceKey) |
|
|
|
|
|
|
|
NotificationCenter.default.post(name: DataStore.didSyncFromExternalSourceNotification, |
|
|
|
|
|
|
|
object: self) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -201,3 +203,7 @@ class DataStore: NSObject { |
|
|
|
return value.isEqual(to: NSNumber(value: 0)) |
|
|
|
return value.isEqual(to: NSNumber(value: 0)) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
extension DataStore { |
|
|
|
|
|
|
|
public static let didSyncFromExternalSourceNotification: NSNotification.Name = .init("didSyncFromExternalSourceNotification") |
|
|
|
|
|
|
|
} |
|
|
|