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, CLTruncateTextLength: 30,
CLSelectedCalendars: [], CLSelectedCalendars: [],
CLAppDisplayOptions: 1, CLAppDisplayOptions: 1,
CLMenubarCompactMode: 1] CLMenubarCompactMode: 1,
CLDisplayDSTTransitionInfo: 0]
} }
} }

3
Clocker/Overall App/DataStore.swift

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

1
Clocker/Overall App/Strings.swift

@ -37,3 +37,4 @@ let CLDefaultMenubarMode = "com.abhishek.shouldDefaultToCompactMode"
let CLInstallHomeIndicatorObject = "installHomeIndicatorObject" let CLInstallHomeIndicatorObject = "installHomeIndicatorObject"
let CLDefaultThemeOnMojave = "com.abhishek.defaultHasBeenSetOnMacOsMojave" let CLDefaultThemeOnMojave = "com.abhishek.defaultHasBeenSetOnMacOsMojave"
let CLSwitchToCompactModeAlert = "com.abhishek.switchToCompactMode" 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? { func nextDaylightSavingsTransitionIfAvailable(with sliderValue: Int) -> String? {
if DataStore.shared().shouldDisplay(.dstTransitionInfo) == false {
return nil
}
let currentTimezone = TimeZone(identifier: dataObject.timezone()) let currentTimezone = TimeZone(identifier: dataObject.timezone())
guard let nextDaylightSavingsTransition = currentTimezone?.nextDaylightSavingTimeTransition else { guard let nextDaylightSavingsTransition = currentTimezone?.nextDaylightSavingTimeTransition else {
return nil return nil

Loading…
Cancel
Save