Browse Source

Menubar formatting...

pull/92/head
Abhishek 4 years ago
parent
commit
33924661a9
  1. 11
      Clocker/Menu Bar/StatusContainerView.swift
  2. 10
      Clocker/Overall App/DataStore.swift
  3. 5
      Clocker/Panel/PanelController.swift

11
Clocker/Menu Bar/StatusContainerView.swift

@ -9,7 +9,7 @@ func bufferCalculatedWidth() -> Int {
totalWidth += 12 totalWidth += 12
} }
if DataStore.shared().shouldDisplay(.twelveHour) { if DataStore.shared().isBufferRequiredForTwelveHourFormats() {
totalWidth += 20 totalWidth += 20
} }
@ -28,9 +28,13 @@ func compactWidth(for timezone: TimezoneData) -> Int {
totalWidth += 12 totalWidth += 12
} }
if timeFormat == DateFormat.twelveHour || timeFormat == DateFormat.twelveHourWithSeconds { if timeFormat == DateFormat.twelveHour
|| timeFormat == DateFormat.twelveHourWithSeconds
|| timeFormat == DateFormat.twelveHourWithZero
|| timeFormat == DateFormat.twelveHourWithSeconds {
totalWidth += 20 totalWidth += 20
} else if timeFormat == DateFormat.twentyFourHour || timeFormat == DateFormat.twentyFourHourWithSeconds { } else if timeFormat == DateFormat.twentyFourHour
|| timeFormat == DateFormat.twentyFourHourWithSeconds {
totalWidth += 0 totalWidth += 0
} }
@ -43,6 +47,7 @@ func compactWidth(for timezone: TimezoneData) -> Int {
totalWidth += 20 totalWidth += 20
} }
print("-- Compact Width is \(totalWidth)")
return totalWidth return totalWidth
} }

10
Clocker/Overall App/DataStore.swift

@ -110,6 +110,16 @@ class DataStore: NSObject {
return userDefaults.object(forKey: CLSelectedTimeZoneFormatKey) as? NSNumber ?? NSNumber(integerLiteral: 0) return userDefaults.object(forKey: CLSelectedTimeZoneFormatKey) as? NSNumber ?? NSNumber(integerLiteral: 0)
} }
static let timeFormatsWithSuffix: Set<NSNumber> = 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 { func shouldDisplay(_ type: ViewType) -> Bool {
switch type { switch type {
case .futureSlider: case .futureSlider:

5
Clocker/Panel/PanelController.swift

@ -269,10 +269,7 @@ class PanelController: ParentPanelController {
func minimize() { func minimize() {
let delegate = NSApplication.shared.delegate as? AppDelegate let delegate = NSApplication.shared.delegate as? AppDelegate
if DataStore.shared().shouldDisplay(.showMeetingInMenubar) == true {
let count = DataStore.shared().menubarTimezones()?.count ?? 0
if count >= 1 || DataStore.shared().shouldDisplay(.showMeetingInMenubar) == true {
if let handler = delegate?.statusItemForPanel(), let timer = handler.menubarTimer, !timer.isValid { if let handler = delegate?.statusItemForPanel(), let timer = handler.menubarTimer, !timer.isValid {
delegate?.setupMenubarTimer() delegate?.setupMenubarTimer()
} }

Loading…
Cancel
Save