Browse Source

Clean up DST Transition gating.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
2e2efd2179
  1. 3
      Clocker/Overall App/AppDefaults.swift
  2. 1
      Clocker/Overall App/ConfigExport.swift
  3. 3
      Clocker/Overall App/DataStore.swift
  4. 1
      Clocker/Overall App/Strings.swift
  5. 9
      Clocker/Panel/ParentPanelController.swift
  6. 4
      Clocker/Panel/UI/TimezoneDataSource.swift
  7. 6
      Clocker/Preferences/Appearance/AppearanceViewController.swift

3
Clocker/Overall App/AppDefaults.swift

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

1
Clocker/Overall App/ConfigExport.swift

@ -29,7 +29,6 @@ struct ConfigExport {
CLDefaultMenubarMode,
CLInstallHomeIndicatorObject,
CLSwitchToCompactModeAlert,
CLDisplayDSTTransitionInfo,
])
let dictionaryRep = UserDefaults.standard.dictionaryRepresentation()
var clockerPrefs: [String: Any] = [:]

3
Clocker/Overall App/DataStore.swift

@ -17,7 +17,6 @@ enum ViewType {
case placeInMenubar
case dayInMenubar
case menubarCompactMode
case dstTransitionInfo
case sync
}
@ -181,8 +180,6 @@ 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

@ -35,6 +35,5 @@ let CLMenubarCompactMode = "com.abhishek.menubarCompactMode"
let CLDefaultMenubarMode = "com.abhishek.shouldDefaultToCompactMode"
let CLInstallHomeIndicatorObject = "installHomeIndicatorObject"
let CLSwitchToCompactModeAlert = "com.abhishek.switchToCompactMode"
let CLDisplayDSTTransitionInfo = "com.abhishek.showDSTTransitionInfo"
let CLAppleInterfaceStyleKey = "AppleInterfaceStyle"
let CLEnableSyncKey = "com.abhishek.enableSync"

9
Clocker/Panel/ParentPanelController.swift

@ -425,8 +425,7 @@ class ParentPanelController: NSWindowController {
newHeight = userFontSize == 4 ? 68.0 : 68.0
if let note = object?.note, note.isEmpty == false {
newHeight += 20
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo),
let obj = object,
} else if let obj = object,
TimezoneDataOperations(with: obj).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) != nil
{
newHeight += 20
@ -437,7 +436,7 @@ class ParentPanelController: NSWindowController {
// Set it to 90 expicity in case the row height is calculated be higher.
newHeight = 88.0
if let note = object?.note, note.isEmpty, DataStore.shared().shouldDisplay(.dstTransitionInfo) == false, let obj = object, TimezoneDataOperations(with: obj).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) == nil {
if let note = object?.note, note.isEmpty, let obj = object, TimezoneDataOperations(with: obj).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) == nil {
newHeight -= 20.0
}
}
@ -636,9 +635,7 @@ class ParentPanelController: NSWindowController {
}
if let note = model.note, !note.isEmpty {
cellView.noteLabel.stringValue = note
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo),
let value = TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue)
{
} else if let value = TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) {
cellView.noteLabel.stringValue = value
} else {
cellView.noteLabel.stringValue = CLEmptyString

4
Clocker/Panel/UI/TimezoneDataSource.swift

@ -68,7 +68,7 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
cellView.relativeDate.setAccessibilityIdentifier("RelativeDate")
if let note = currentModel.note, !note.isEmpty {
cellView.noteLabel.stringValue = note
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo), let value = operation.nextDaylightSavingsTransitionIfAvailable(with: sliderValue) {
} else if let value = operation.nextDaylightSavingsTransitionIfAvailable(with: sliderValue) {
cellView.noteLabel.stringValue = value
} else {
cellView.noteLabel.stringValue = CLEmptyString
@ -101,7 +101,7 @@ extension TimezoneDataSource: NSTableViewDataSource, NSTableViewDelegate {
if let note = model.note, !note.isEmpty {
rowHeight += userFontSize.intValue + 15
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo), TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: sliderValue) != nil {
} else if TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: sliderValue) != nil {
rowHeight += userFontSize.intValue + 15
}

6
Clocker/Preferences/Appearance/AppearanceViewController.swift

@ -389,9 +389,7 @@ extension AppearanceViewController: NSTableViewDataSource, NSTableViewDelegate {
cellView.rowNumber = row
cellView.customName.stringValue = currentModel.formattedTimezoneLabel()
cellView.time.stringValue = operation.time(with: 0)
if DataStore.shared().shouldDisplay(.dstTransitionInfo) {
cellView.noteLabel.stringValue = "Heads up! DST Transition will occur in 3 days."
} else if let note = currentModel.note, !note.isEmpty {
if let note = currentModel.note, !note.isEmpty {
cellView.noteLabel.stringValue = note
} else {
cellView.noteLabel.stringValue = CLEmptyString
@ -413,8 +411,6 @@ extension AppearanceViewController: NSTableViewDataSource, NSTableViewDelegate {
let rowHeight: Int = userFontSize == 4 ? 60 : 65
if let note = model.note, !note.isEmpty {
return CGFloat(rowHeight + userFontSize.intValue + 25)
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo) {
return CGFloat(rowHeight + userFontSize.intValue + 25)
}
return CGFloat(rowHeight + (userFontSize.intValue * 2))

Loading…
Cancel
Save