Browse Source

Merge branch 'master' of https://github.com/n0shake/Clocker

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
30502e8c4d
  1. 27
      Clocker/Overall App/DataStore.swift

27
Clocker/Overall App/DataStore.swift

@ -28,6 +28,11 @@ class DataStore: NSObject {
// Since these pref can accessed every second, let's cache this
private var shouldDisplayDayInMenubar: Bool = false
private var shouldDisplayDateInMenubar: Bool = false
private static let timeFormatsWithSuffix: Set<NSNumber> = Set([NSNumber(integerLiteral: 0),
NSNumber(integerLiteral: 3),
NSNumber(integerLiteral: 4),
NSNumber(integerLiteral: 6),
NSNumber(integerLiteral: 7)])
class func shared() -> DataStore {
return sharedStore
@ -109,23 +114,10 @@ class DataStore: NSObject {
setTimezones(currentLineup)
}
private func shouldDisplayHelper(_ key: String) -> Bool {
guard let value = retrieve(key: key) as? NSNumber else {
return false
}
return value.isEqual(to: NSNumber(value: 0))
}
func timezoneFormat() -> NSNumber {
return userDefaults.object(forKey: CLSelectedTimeZoneFormatKey) as? NSNumber ?? NSNumber(integerLiteral: 0)
}
static let timeFormatsWithSuffix: Set<NSNumber> = Set([NSNumber(integerLiteral: 0),
NSNumber(integerLiteral: 3),
NSNumber(integerLiteral: 4),
NSNumber(integerLiteral: 6),
NSNumber(integerLiteral: 7)])
func isBufferRequiredForTwelveHourFormats() -> Bool {
return DataStore.timeFormatsWithSuffix.contains(timezoneFormat())
}
@ -173,4 +165,13 @@ class DataStore: NSObject {
return value == 0
}
}
//MARK: Private
private func shouldDisplayHelper(_ key: String) -> Bool {
guard let value = retrieve(key: key) as? NSNumber else {
return false
}
return value.isEqual(to: NSNumber(value: 0))
}
}

Loading…
Cancel
Save