diff --git a/Clocker/Menu Bar/StatusContainerView.swift b/Clocker/Menu Bar/StatusContainerView.swift index 9a1c46f..8890b50 100644 --- a/Clocker/Menu Bar/StatusContainerView.swift +++ b/Clocker/Menu Bar/StatusContainerView.swift @@ -9,7 +9,7 @@ func bufferCalculatedWidth() -> Int { totalWidth += 12 } - if DataStore.shared().shouldDisplay(.twelveHour) { + if DataStore.shared().isBufferRequiredForTwelveHourFormats() { totalWidth += 20 } @@ -28,9 +28,13 @@ func compactWidth(for timezone: TimezoneData) -> Int { totalWidth += 12 } - if timeFormat == DateFormat.twelveHour || timeFormat == DateFormat.twelveHourWithSeconds { + if timeFormat == DateFormat.twelveHour + || timeFormat == DateFormat.twelveHourWithSeconds + || timeFormat == DateFormat.twelveHourWithZero + || timeFormat == DateFormat.twelveHourWithSeconds { totalWidth += 20 - } else if timeFormat == DateFormat.twentyFourHour || timeFormat == DateFormat.twentyFourHourWithSeconds { + } else if timeFormat == DateFormat.twentyFourHour + || timeFormat == DateFormat.twentyFourHourWithSeconds { totalWidth += 0 } @@ -43,6 +47,7 @@ func compactWidth(for timezone: TimezoneData) -> Int { totalWidth += 20 } + print("-- Compact Width is \(totalWidth)") return totalWidth } diff --git a/Clocker/Overall App/DataStore.swift b/Clocker/Overall App/DataStore.swift index 3d1f5f5..72098aa 100644 --- a/Clocker/Overall App/DataStore.swift +++ b/Clocker/Overall App/DataStore.swift @@ -110,6 +110,16 @@ class DataStore: NSObject { return userDefaults.object(forKey: CLSelectedTimeZoneFormatKey) as? NSNumber ?? NSNumber(integerLiteral: 0) } + static let timeFormatsWithSuffix: Set = Set([NSNumber(integerLiteral: 0), + NSNumber(integerLiteral: 3), + NSNumber(integerLiteral: 4), + NSNumber(integerLiteral: 6), + NSNumber(integerLiteral: 7)]) + + func isBufferRequiredForTwelveHourFormats() -> Bool { + return DataStore.timeFormatsWithSuffix.contains(timezoneFormat()) + } + func shouldDisplay(_ type: ViewType) -> Bool { switch type { case .futureSlider: diff --git a/Clocker/Panel/PanelController.swift b/Clocker/Panel/PanelController.swift index b145cee..6a01226 100644 --- a/Clocker/Panel/PanelController.swift +++ b/Clocker/Panel/PanelController.swift @@ -269,10 +269,7 @@ class PanelController: ParentPanelController { func minimize() { let delegate = NSApplication.shared.delegate as? AppDelegate - - let count = DataStore.shared().menubarTimezones()?.count ?? 0 - - if count >= 1 || DataStore.shared().shouldDisplay(.showMeetingInMenubar) == true { + if DataStore.shared().shouldDisplay(.showMeetingInMenubar) == true { if let handler = delegate?.statusItemForPanel(), let timer = handler.menubarTimer, !timer.isValid { delegate?.setupMenubarTimer() }