|
|
@ -44,7 +44,10 @@ class DataStore: NSObject { |
|
|
|
userDefaults = defaults |
|
|
|
userDefaults = defaults |
|
|
|
shouldDisplayDayInMenubar = shouldDisplay(.dayInMenubar) |
|
|
|
shouldDisplayDayInMenubar = shouldDisplay(.dayInMenubar) |
|
|
|
shouldDisplayDateInMenubar = shouldDisplay(.dateInMenubar) |
|
|
|
shouldDisplayDateInMenubar = shouldDisplay(.dateInMenubar) |
|
|
|
|
|
|
|
setupSyncNotification() |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
func setupSyncNotification() { |
|
|
|
if shouldDisplay(.sync) { |
|
|
|
if shouldDisplay(.sync) { |
|
|
|
ubiquitousStore = NSUbiquitousKeyValueStore.default |
|
|
|
ubiquitousStore = NSUbiquitousKeyValueStore.default |
|
|
|
NotificationCenter.default.addObserver(self, |
|
|
|
NotificationCenter.default.addObserver(self, |
|
|
@ -52,6 +55,10 @@ class DataStore: NSObject { |
|
|
|
name: NSUbiquitousKeyValueStore.didChangeExternallyNotification, |
|
|
|
name: NSUbiquitousKeyValueStore.didChangeExternallyNotification, |
|
|
|
object: NSUbiquitousKeyValueStore.default) |
|
|
|
object: NSUbiquitousKeyValueStore.default) |
|
|
|
ubiquitousStore?.synchronize() |
|
|
|
ubiquitousStore?.synchronize() |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
NotificationCenter.default.removeObserver(self, |
|
|
|
|
|
|
|
name: NSUbiquitousKeyValueStore.didChangeExternallyNotification, |
|
|
|
|
|
|
|
object: nil) |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|