Browse Source

Gating dst transition info!

pull/92/head
Abhishek 4 years ago
parent
commit
27a4808fc6
  1. 3
      Clocker/Overall App/AppDefaults.swift
  2. 3
      Clocker/Overall App/DataStore.swift
  3. 1
      Clocker/Overall App/Strings.swift
  4. 4
      Clocker/Panel/Data Layer/TimezoneDataOperations.swift

3
Clocker/Overall App/AppDefaults.swift

@ -127,7 +127,8 @@ class AppDefaults {
CLTruncateTextLength: 30,
CLSelectedCalendars: [],
CLAppDisplayOptions: 1,
CLMenubarCompactMode: 1]
CLMenubarCompactMode: 1,
CLDisplayDSTTransitionInfo: 0]
}
}

3
Clocker/Overall App/DataStore.swift

@ -16,6 +16,7 @@ enum ViewType {
case placeInMenubar
case dayInMenubar
case menubarCompactMode
case dstTransitionInfo
}
class DataStore: NSObject {
@ -138,6 +139,8 @@ class DataStore: NSObject {
return shouldDisplayHelper(CLShowDayInMenu)
case .appDisplayOptions:
return shouldDisplayHelper(CLAppDisplayOptions)
case .dstTransitionInfo:
return shouldDisplayHelper(CLDisplayDSTTransitionInfo)
case .menubarCompactMode:
guard let value = retrieve(key: CLMenubarCompactMode) as? Int else {
return false

1
Clocker/Overall App/Strings.swift

@ -37,3 +37,4 @@ let CLDefaultMenubarMode = "com.abhishek.shouldDefaultToCompactMode"
let CLInstallHomeIndicatorObject = "installHomeIndicatorObject"
let CLDefaultThemeOnMojave = "com.abhishek.defaultHasBeenSetOnMacOsMojave"
let CLSwitchToCompactModeAlert = "com.abhishek.switchToCompactMode"
let CLDisplayDSTTransitionInfo = "com.abhishek.showDSTTransitionInfo"

4
Clocker/Panel/Data Layer/TimezoneDataOperations.swift

@ -34,6 +34,10 @@ extension TimezoneDataOperations {
}
func nextDaylightSavingsTransitionIfAvailable(with sliderValue: Int) -> String? {
if DataStore.shared().shouldDisplay(.dstTransitionInfo) == false {
return nil
}
let currentTimezone = TimeZone(identifier: dataObject.timezone())
guard let nextDaylightSavingsTransition = currentTimezone?.nextDaylightSavingTimeTransition else {
return nil

Loading…
Cancel
Save