From 27a4808fc6d5c826d93e4be08114729c65e53486 Mon Sep 17 00:00:00 2001 From: Abhishek Date: Sat, 24 Oct 2020 03:53:54 -0500 Subject: [PATCH] Gating dst transition info! --- Clocker/Overall App/AppDefaults.swift | 3 ++- Clocker/Overall App/DataStore.swift | 3 +++ Clocker/Overall App/Strings.swift | 1 + Clocker/Panel/Data Layer/TimezoneDataOperations.swift | 4 ++++ 4 files changed, 10 insertions(+), 1 deletion(-) diff --git a/Clocker/Overall App/AppDefaults.swift b/Clocker/Overall App/AppDefaults.swift index 86b52cb..a98c096 100644 --- a/Clocker/Overall App/AppDefaults.swift +++ b/Clocker/Overall App/AppDefaults.swift @@ -127,7 +127,8 @@ class AppDefaults { CLTruncateTextLength: 30, CLSelectedCalendars: [], CLAppDisplayOptions: 1, - CLMenubarCompactMode: 1] + CLMenubarCompactMode: 1, + CLDisplayDSTTransitionInfo: 0] } } diff --git a/Clocker/Overall App/DataStore.swift b/Clocker/Overall App/DataStore.swift index 3e18a7c..3fad483 100644 --- a/Clocker/Overall App/DataStore.swift +++ b/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 diff --git a/Clocker/Overall App/Strings.swift b/Clocker/Overall App/Strings.swift index 3faaf11..aa2305b 100644 --- a/Clocker/Overall App/Strings.swift +++ b/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" diff --git a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift b/Clocker/Panel/Data Layer/TimezoneDataOperations.swift index aa3fe05..bc61bee 100644 --- a/Clocker/Panel/Data Layer/TimezoneDataOperations.swift +++ b/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