Browse Source

Merge branch 'master' of https://github.com/n0shake/Clocker

pull/92/head
Abhishek 4 years ago
parent
commit
c0e8635c18
  1. 2
      .travis.yml
  2. 109
      Clocker/ClockerUnitTests/ClockerUnitTests.swift
  3. 8
      Clocker/Menu Bar/StatusContainerView.swift
  4. 2
      Clocker/Onboarding/OnboardingSearchController.swift
  5. 3
      Clocker/Overall App/AppDefaults.swift
  6. 7
      Clocker/Overall App/DataStore.swift
  7. 3
      Clocker/Overall App/Strings.swift
  8. 2
      Clocker/Overall App/Themer.swift
  9. 12
      Clocker/Overall App/VersionUpdateHandler.swift
  10. 20
      Clocker/Panel/Data Layer/TimezoneData.swift
  11. 11
      Clocker/Panel/Notes Popover/NotesPopover.swift
  12. 2
      Clocker/Panel/Notes Popover/NotesPopover.xib
  13. 2
      Clocker/Panel/PanelController.swift
  14. 22
      Clocker/Preferences/Appearance/AppearanceViewController.swift
  15. 27
      Clocker/Preferences/Preferences.storyboard

2
.travis.yml

@ -3,7 +3,7 @@ language: swift
xcode_project: Clocker.xcodeproj # path to your xcodeproj folder xcode_project: Clocker.xcodeproj # path to your xcodeproj folder
osx_image: xcode12.2 osx_image: xcode12.2
before_install: before_install:
- export TZ=America/Los_Angeles - export TZ=America/Chicago
before_script: before_script:
- xcodebuild -version - xcodebuild -version
install: install:

109
Clocker/ClockerUnitTests/ClockerUnitTests.swift

@ -72,8 +72,7 @@ class ClockerUnitTests: XCTestCase {
func testOverridingSecondsComponent_shouldHideSeconds() { func testOverridingSecondsComponent_shouldHideSeconds() {
let dummyDefaults = UserDefaults.standard let dummyDefaults = UserDefaults.standard
dummyDefaults.set(NSNumber(value: 0), forKey: CLShowSecondsInMenubar) dummyDefaults.set(NSNumber(value: 4), forKey: CLSelectedTimeZoneFormatKey) // 4 is 12 hour with seconds
dummyDefaults.set(NSNumber(value: 1), forKey: CL24hourFormatSelectedKey)
let timezoneObjects = [TimezoneData(with: mumbai), let timezoneObjects = [TimezoneData(with: mumbai),
TimezoneData(with: auckland), TimezoneData(with: auckland),
@ -84,37 +83,11 @@ class ClockerUnitTests: XCTestCase {
let currentTime = operationsObject.time(with: 0) let currentTime = operationsObject.time(with: 0)
XCTAssert(currentTime.count == 8) // 8 includes 2 colons XCTAssert(currentTime.count == 8) // 8 includes 2 colons
$0.setShouldOverrideSecondsFormat(1) $0.setShouldOverrideGlobalTimeFormat(1)
let newTime = operationsObject.time(with: 0)
XCTAssert(newTime.count == 5) // 5 includes colon
}
// Reset
dummyDefaults.set(NSNumber(value: 1), forKey: CLShowSecondsInMenubar)
}
func testOverridingSecondsComponentFor12HourFormat_shouldHideSeconds() {
let dummyDefaults = UserDefaults.standard
dummyDefaults.set(NSNumber(value: 0), forKey: CLShowSecondsInMenubar)
dummyDefaults.set(NSNumber(value: 0), forKey: CL24hourFormatSelectedKey)
let timezoneObjects = [TimezoneData(with: mumbai),
TimezoneData(with: auckland),
TimezoneData(with: california)]
timezoneObjects.forEach {
let operationsObject = TimezoneDataOperations(with: $0)
let currentTime = operationsObject.time(with: 0)
XCTAssert(currentTime.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).count >= 10) // 8 includes 2 colons
$0.setShouldOverrideSecondsFormat(1)
let newTime = operationsObject.time(with: 0) let newTime = operationsObject.time(with: 0)
XCTAssert(newTime.count == 7) // 5 includes colon
XCTAssert(newTime.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines).count >= 7) // 5 includes colon
} }
// Reset
dummyDefaults.set(NSNumber(value: 1), forKey: CLShowSecondsInMenubar)
dummyDefaults.set(NSNumber(value: 1), forKey: CL24hourFormatSelectedKey)
} }
func testAddingATimezoneToDefaults() { func testAddingATimezoneToDefaults() {
@ -155,11 +128,11 @@ class ClockerUnitTests: XCTestCase {
// The below test might fail outside California or if DST is active! // The below test might fail outside California or if DST is active!
// CI is calibrated to be on LA timezone! // CI is calibrated to be on LA timezone!
func testTimeDifference() { func testTimeDifference() {
XCTAssertTrue(operations.timeDifference() == ", 13 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())") XCTAssertTrue(operations.timeDifference() == ", 11 hours 30 mins ahead", "Difference was unexpectedly: \(operations.timeDifference())")
XCTAssertTrue(californiaOperations.timeDifference() == "", "Difference was unexpectedly: \(californiaOperations.timeDifference())") XCTAssertTrue(californiaOperations.timeDifference() == ", 2 hours behind", "Difference was unexpectedly: \(californiaOperations.timeDifference())")
XCTAssertTrue(floridaOperations.timeDifference() == ", 3 hours ahead", "Difference was unexpectedly: \(floridaOperations.timeDifference())") XCTAssertTrue(floridaOperations.timeDifference() == ", an hour ahead", "Difference was unexpectedly: \(floridaOperations.timeDifference())")
XCTAssertTrue(aucklandOperations.timeDifference() == ", 21 hours ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())") XCTAssertTrue(aucklandOperations.timeDifference() == ", 19 hours ahead", "Difference was unexpectedly: \(aucklandOperations.timeDifference())")
XCTAssertTrue(omahaOperations.timeDifference() == ", 2 hours ahead", "Difference was unexpectedly: \(omahaOperations.timeDifference())") XCTAssertTrue(omahaOperations.timeDifference() == "", "Difference was unexpectedly: \(omahaOperations.timeDifference())")
} }
func testSunriseSunset() { func testSunriseSunset() {
@ -188,34 +161,72 @@ class ClockerUnitTests: XCTestCase {
func testTimezoneFormat() { func testTimezoneFormat() {
let dataObject = TimezoneData(with: mumbai) let dataObject = TimezoneData(with: mumbai)
UserDefaults.standard.set(NSNumber(value: 0), forKey: CLShowSecondsInMenubar) // Set to show seconds UserDefaults.standard.set(NSNumber(value: 0), forKey: CLSelectedTimeZoneFormatKey) // Set to 12 hour format
UserDefaults.standard.set(NSNumber(value: 0), forKey: CL24hourFormatSelectedKey) // Set to 12 hour format
dataObject.setShouldOverrideGlobalTimeFormat(0) dataObject.setShouldOverrideGlobalTimeFormat(0) // Respect Global Preference
XCTAssertTrue(dataObject.timezoneFormat() == "h:mm:ss a") XCTAssertTrue(dataObject.timezoneFormat() == "h:mm a")
dataObject.setShouldOverrideGlobalTimeFormat(1) dataObject.setShouldOverrideGlobalTimeFormat(1) // 12-Hour Format
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm:ss") XCTAssertTrue(dataObject.timezoneFormat() == "h:mm a")
dataObject.setShouldOverrideGlobalTimeFormat(2) // 24-Hour format
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm")
dataObject.setShouldOverrideGlobalTimeFormat(2) // Skip 3 since it's a placeholder
dataObject.setShouldOverrideGlobalTimeFormat(4) // 12-Hour with seconds
XCTAssertTrue(dataObject.timezoneFormat() == "h:mm:ss a") XCTAssertTrue(dataObject.timezoneFormat() == "h:mm:ss a")
UserDefaults.standard.set(NSNumber(value: 1), forKey: CL24hourFormatSelectedKey) // Set to 24-Hour Format dataObject.setShouldOverrideGlobalTimeFormat(5) // 24-Hour format with seconds
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm:ss") XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm:ss")
UserDefaults.standard.set(NSNumber(value: 1), forKey: CLShowSecondsInMenubar) // Skip 6 since it's a placeholder
dataObject.setShouldOverrideGlobalTimeFormat(7) // 12-hour with preceding zero and no seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm a")
dataObject.setShouldOverrideGlobalTimeFormat(8) // 12-hour with preceding zero and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm:ss a")
// Skip 9 since it's a placeholder
dataObject.setShouldOverrideGlobalTimeFormat(10) // 12-hour without am/pm and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm")
dataObject.setShouldOverrideGlobalTimeFormat(11) // 12-hour with preceding zero and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm:ss")
}
func testTimezoneFormatWithDefaultSetAs24HourFormat() {
let dataObject = TimezoneData(with: california)
UserDefaults.standard.set(NSNumber(value: 1), forKey: CLSelectedTimeZoneFormatKey) // Set to 24-Hour Format
dataObject.setShouldOverrideGlobalTimeFormat(0) dataObject.setShouldOverrideGlobalTimeFormat(0)
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm")
dataObject.setShouldOverrideGlobalTimeFormat(1) // 12-Hour Format
XCTAssertTrue(dataObject.timezoneFormat() == "h:mm a") XCTAssertTrue(dataObject.timezoneFormat() == "h:mm a")
dataObject.setShouldOverrideGlobalTimeFormat(1) dataObject.setShouldOverrideGlobalTimeFormat(2) // 24-Hour format
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm") XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm")
dataObject.setShouldOverrideGlobalTimeFormat(2) // Skip 3 since it's a placeholder
XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm") dataObject.setShouldOverrideGlobalTimeFormat(4) // 12-Hour with seconds
XCTAssertTrue(dataObject.timezoneFormat() == "h:mm:ss a")
UserDefaults.standard.set(NSNumber(value: 0), forKey: CL24hourFormatSelectedKey) dataObject.setShouldOverrideGlobalTimeFormat(5) // 24-Hour format with seconds
XCTAssertTrue(dataObject.timezoneFormat() == "h:mm a") XCTAssertTrue(dataObject.timezoneFormat() == "HH:mm:ss")
// Skip 6 since it's a placeholder
dataObject.setShouldOverrideGlobalTimeFormat(7) // 12-hour with preceding zero and no seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm a")
dataObject.setShouldOverrideGlobalTimeFormat(8) // 12-hour with preceding zero and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm:ss a")
// Skip 9 since it's a placeholder
dataObject.setShouldOverrideGlobalTimeFormat(10) // 12-hour without am/pm and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm")
dataObject.setShouldOverrideGlobalTimeFormat(11) // 12-hour with preceding zero and seconds
XCTAssertTrue(dataObject.timezoneFormat() == "hh:mm:ss")
} }
func testFormattedLabel() { func testFormattedLabel() {

8
Clocker/Menu Bar/StatusContainerView.swift

@ -13,10 +13,6 @@ func bufferCalculatedWidth() -> Int {
totalWidth += 20 totalWidth += 20
} }
if DataStore.shared().shouldDisplay(.seconds) {
totalWidth += 15
}
if DataStore.shared().shouldShowDateInMenubar() { if DataStore.shared().shouldShowDateInMenubar() {
totalWidth += 20 totalWidth += 20
} }
@ -85,7 +81,9 @@ class StatusContainerView: NSView {
let operationObject = TimezoneDataOperations(with: timezoneObject) let operationObject = TimezoneDataOperations(with: timezoneObject)
let calculatedSubtitleSize = compactModeTimeFont.size(operationObject.compactMenuSubtitle(), precalculatedWidth, attributes: timeBasedAttributes) let calculatedSubtitleSize = compactModeTimeFont.size(operationObject.compactMenuSubtitle(), precalculatedWidth, attributes: timeBasedAttributes)
let calculatedTitleSize = compactModeTimeFont.size(operationObject.compactMenuTitle(), precalculatedWidth, attributes: timeBasedAttributes) let calculatedTitleSize = compactModeTimeFont.size(operationObject.compactMenuTitle(), precalculatedWidth, attributes: timeBasedAttributes)
return result + max(calculatedTitleSize.width, calculatedSubtitleSize.width) + bufferWidth let showSeconds = timezoneObject.shouldShowSeconds()
let secondsBuffer: CGFloat = showSeconds ? 7 : 0
return result + max(calculatedTitleSize.width, calculatedSubtitleSize.width) + bufferWidth + secondsBuffer
} }
return result + CGFloat(bufferCalculatedWidth()) return result + CGFloat(bufferCalculatedWidth())

2
Clocker/Onboarding/OnboardingSearchController.swift

@ -18,7 +18,7 @@ class OnboardingSearchController: NSViewController {
guard let path = Bundle.main.path(forResource: "Keys", ofType: "plist"), guard let path = Bundle.main.path(forResource: "Keys", ofType: "plist"),
let dictionary = NSDictionary(contentsOfFile: path), let dictionary = NSDictionary(contentsOfFile: path),
let apiKey = dictionary["GeocodingKey"] as? String else { let apiKey = dictionary["GeocodingKey"] as? String else {
assertionFailure("Unable to find the API key") // assertionFailure("Unable to find the API key")
return "" return ""
} }
return apiKey return apiKey

3
Clocker/Overall App/AppDefaults.swift

@ -99,14 +99,13 @@ class AppDefaults {
private class func defaultsDictionary() -> [String: Any] { private class func defaultsDictionary() -> [String: Any] {
return [CLThemeKey: 0, return [CLThemeKey: 0,
CLDisplayFutureSliderKey: 0, CLDisplayFutureSliderKey: 0,
CL24hourFormatSelectedKey: 1, CLSelectedTimeZoneFormatKey: 0, // 12-hour format
CLRelativeDateKey: 0, CLRelativeDateKey: 0,
CLShowDayInMenu: 0, CLShowDayInMenu: 0,
CLShowDateInMenu: 1, CLShowDateInMenu: 1,
CLShowPlaceInMenu: 0, CLShowPlaceInMenu: 0,
CLStartAtLogin: 0, CLStartAtLogin: 0,
CLSunriseSunsetTime: 1, CLSunriseSunsetTime: 1,
CLShowSecondsInMenubar: 1,
CLUserFontSizePreference: 4, CLUserFontSizePreference: 4,
CLShowUpcomingEventView: "YES", CLShowUpcomingEventView: "YES",
CLShowAppInForeground: 0, CLShowAppInForeground: 0,

7
Clocker/Overall App/DataStore.swift

@ -7,7 +7,6 @@ enum ViewType {
case upcomingEventView case upcomingEventView
case twelveHour case twelveHour
case sunrise case sunrise
case seconds
case showMeetingInMenubar case showMeetingInMenubar
case showAllDayEventsInMenubar case showAllDayEventsInMenubar
case showAppInForeground case showAppInForeground
@ -108,7 +107,7 @@ class DataStore: NSObject {
} }
func timezoneFormat() -> NSNumber { func timezoneFormat() -> NSNumber {
return userDefaults.object(forKey: CL24hourFormatSelectedKey) as? NSNumber ?? NSNumber(integerLiteral: 0) return userDefaults.object(forKey: CLSelectedTimeZoneFormatKey) as? NSNumber ?? NSNumber(integerLiteral: 0)
} }
func shouldDisplay(_ type: ViewType) -> Bool { func shouldDisplay(_ type: ViewType) -> Bool {
@ -121,13 +120,11 @@ class DataStore: NSObject {
} }
return value == "YES" return value == "YES"
case .twelveHour: case .twelveHour:
return shouldDisplayHelper(CL24hourFormatSelectedKey) return shouldDisplayHelper(CLSelectedTimeZoneFormatKey)
case .showAllDayEventsInMenubar: case .showAllDayEventsInMenubar:
return shouldDisplayHelper(CLShowAllDayEventsInUpcomingView) return shouldDisplayHelper(CLShowAllDayEventsInUpcomingView)
case .sunrise: case .sunrise:
return shouldDisplayHelper(CLSunriseSunsetTime) return shouldDisplayHelper(CLSunriseSunsetTime)
case .seconds:
return shouldDisplayHelper(CLShowSecondsInMenubar)
case .showMeetingInMenubar: case .showMeetingInMenubar:
return shouldDisplayHelper(CLShowMeetingInMenubar) return shouldDisplayHelper(CLShowMeetingInMenubar)
case .showAppInForeground: case .showAppInForeground:

3
Clocker/Overall App/Strings.swift

@ -6,7 +6,7 @@ let CLEmptyString = ""
let CLDefaultPreferenceKey = "defaultPreferences" let CLDefaultPreferenceKey = "defaultPreferences"
let CLTimezoneName = "formattedAddress" let CLTimezoneName = "formattedAddress"
let CLCustomLabel = "customLabel" let CLCustomLabel = "customLabel"
let CL24hourFormatSelectedKey = "is24HourFormatSelected" let CLSelectedTimeZoneFormatKey = "is24HourFormatSelected"
let CLDragSessionKey = "public.text" let CLDragSessionKey = "public.text"
let CLTimezoneID = "timezoneID" let CLTimezoneID = "timezoneID"
let CLPlaceIdentifier = "place_id" let CLPlaceIdentifier = "place_id"
@ -19,7 +19,6 @@ let CLDisplayFutureSliderKey = "displayFutureSlider"
let CLStartAtLogin = "startAtLogin" let CLStartAtLogin = "startAtLogin"
let CLShowAppInForeground = "displayAppAsForegroundApp" let CLShowAppInForeground = "displayAppAsForegroundApp"
let CLSunriseSunsetTime = "showSunriseSetTime" let CLSunriseSunsetTime = "showSunriseSetTime"
let CLShowSecondsInMenubar = "showSeconds"
let CLUserFontSizePreference = "userFontSize" let CLUserFontSizePreference = "userFontSize"
let CLShowUpcomingEventView = "ShowUpcomingEventView" let CLShowUpcomingEventView = "ShowUpcomingEventView"
let CLShowAllDayEventsInUpcomingView = "showAllDayEventsInUpcomingView" let CLShowAllDayEventsInUpcomingView = "showAllDayEventsInUpcomingView"

2
Clocker/Overall App/Themer.swift

@ -446,7 +446,7 @@ extension Themer {
} }
func symbolImage(for name: String) -> NSImage? { func symbolImage(for name: String) -> NSImage? {
assert(name.count > 0) assert(name.isEmpty == false)
if #available(OSX 11.0, *) { if #available(OSX 11.0, *) {
return NSImage(systemSymbolName: name, return NSImage(systemSymbolName: name,

12
Clocker/Overall App/VersionUpdateHandler.swift

@ -45,7 +45,7 @@ class VersionUpdateHandler: NSObject {
appStoreCountry = Locale.current.regionCode appStoreCountry = Locale.current.regionCode
if appStoreCountry == "150" { if appStoreCountry == "150" {
appStoreCountry = "eu" appStoreCountry = "eu"
} else if appStoreCountry.replacingOccurrences(of: "[A-Za-z]{2}", with: "", options: .regularExpression, range: appStoreCountry.startIndex ..< appStoreCountry.endIndex).count > 0 { } else if appStoreCountry.replacingOccurrences(of: "[A-Za-z]{2}", with: "", options: .regularExpression, range: appStoreCountry.startIndex ..< appStoreCountry.endIndex).isEmpty == false {
appStoreCountry = "us" appStoreCountry = "us"
} }
@ -91,7 +91,7 @@ class VersionUpdateHandler: NSObject {
} }
private func updatedURL() -> URL { private func updatedURL() -> URL {
if updateURL.absoluteString.count > 0 { if updateURL.absoluteString.isEmpty == false {
return updateURL return updateURL
} }
@ -257,11 +257,11 @@ class VersionUpdateHandler: NSObject {
scrollView.frame = NSMakeRect(0.0, 0.0, scrollView.frame.size.width, height) scrollView.frame = NSMakeRect(0.0, 0.0, scrollView.frame.size.width, height)
alert.accessoryView = scrollView alert.accessoryView = scrollView
if ignoreButton.count > 0 { if ignoreButton.isEmpty == false {
alert.addButton(withTitle: ignoreButton) alert.addButton(withTitle: ignoreButton)
} }
if remindButton.count > 0 { if remindButton.isEmpty == false {
alert.addButton(withTitle: remindButton) alert.addButton(withTitle: remindButton)
let modalResponse = alert.runModal() let modalResponse = alert.runModal()
@ -309,7 +309,7 @@ class VersionUpdateHandler: NSObject {
if checkingForNewVersion { if checkingForNewVersion {
checkingForNewVersion = false checkingForNewVersion = false
if remoteVersionsDict.count <= 0 { if remoteVersionsDict.isEmpty {
if downloadError != nil { if downloadError != nil {
Logger.info("Update Check Failed because of \(downloadError!.localizedDescription)") Logger.info("Update Check Failed because of \(downloadError!.localizedDescription)")
} else { } else {
@ -347,7 +347,7 @@ class VersionUpdateHandler: NSObject {
} }
let lastVersionString = lastVersion() let lastVersionString = lastVersion()
if lastVersionString.count > 0 || showOnFirstLaunch || previewMode { if lastVersionString.isEmpty == false || showOnFirstLaunch || previewMode {
if applicationVersion.compareVersion(lastVersionString) == ComparisonResult.orderedDescending || previewMode { if applicationVersion.compareVersion(lastVersionString) == ComparisonResult.orderedDescending || previewMode {
// Clear Reminder // Clear Reminder
setLastReminded(nil) setLastReminded(nil)

20
Clocker/Panel/Data Layer/TimezoneData.swift

@ -40,13 +40,19 @@ class TimezoneData: NSObject, NSCoding {
static let values = [ static let values = [
NSNumber(integerLiteral: 0): DateFormat.twelveHour, NSNumber(integerLiteral: 0): DateFormat.twelveHour,
NSNumber(integerLiteral: 1): DateFormat.twelveHourWithSeconds, NSNumber(integerLiteral: 1): DateFormat.twentyFourHour,
NSNumber(integerLiteral: 2): DateFormat.twentyFourHour,
NSNumber(integerLiteral: 3): DateFormat.twentyFourHourWithSeconds, // Seconds
NSNumber(integerLiteral: 4): DateFormat.twelveHourWithZero, NSNumber(integerLiteral: 3): DateFormat.twelveHourWithSeconds,
NSNumber(integerLiteral: 5): DateFormat.twelveHourWithZeroSeconds, NSNumber(integerLiteral: 4): DateFormat.twentyFourHourWithSeconds,
NSNumber(integerLiteral: 6): DateFormat.twelveHourWithoutSuffix,
NSNumber(integerLiteral: 7): DateFormat.twelveHourWithoutSuffixAndSeconds, // Preceding Zero
NSNumber(integerLiteral: 6): DateFormat.twelveHourWithZero,
NSNumber(integerLiteral: 7): DateFormat.twelveHourWithZeroSeconds,
// Suffix
NSNumber(integerLiteral: 8): DateFormat.twelveHourWithoutSuffix,
NSNumber(integerLiteral: 9): DateFormat.twelveHourWithoutSuffixAndSeconds,
] ]
var customLabel: String? var customLabel: String?

11
Clocker/Panel/Notes Popover/NotesPopover.swift

@ -424,17 +424,6 @@ class NotesPopover: NSViewController {
updateContent() updateContent()
} }
} }
@IBAction func customizeSecondsFormat(_ sender: NSSegmentedControl) {
updateTimezoneInDefaultPreferences(with: sender.selectedSegment, .seconds)
refreshMainTableView()
// Update the display if the chosen menubar mode is compact!
if let delegate = NSApplication.shared.delegate as? AppDelegate {
let handler = delegate.statusItemForPanel()
handler.setupStatusItem()
}
}
} }
extension NotesPopover { extension NotesPopover {

2
Clocker/Panel/Notes Popover/NotesPopover.xib

@ -304,7 +304,7 @@
<constraint firstAttribute="width" constant="50" id="n5J-f7-aqy"/> <constraint firstAttribute="width" constant="50" id="n5J-f7-aqy"/>
<constraint firstAttribute="height" constant="25" id="oQ5-uv-Gfg"/> <constraint firstAttribute="height" constant="25" id="oQ5-uv-Gfg"/>
</constraints> </constraints>
<buttonCell key="cell" type="push" title="Done" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xa4-rw-FBZ"> <buttonCell key="cell" type="push" title="Save" bezelStyle="rounded" alignment="center" borderStyle="border" imageScaling="proportionallyDown" inset="2" id="xa4-rw-FBZ">
<behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/> <behavior key="behavior" pushIn="YES" lightByBackground="YES" lightByGray="YES"/>
<font key="font" size="12" name="Avenir-Light"/> <font key="font" size="12" name="Avenir-Light"/>
</buttonCell> </buttonCell>

2
Clocker/Panel/PanelController.swift

@ -171,7 +171,6 @@ class PanelController: ParentPanelController {
let displayFutureSliderKey = DataStore.shared().retrieve(key: CLThemeKey) as? NSNumber, let displayFutureSliderKey = DataStore.shared().retrieve(key: CLThemeKey) as? NSNumber,
let showAppInForeground = DataStore.shared().retrieve(key: CLShowAppInForeground) as? NSNumber, let showAppInForeground = DataStore.shared().retrieve(key: CLShowAppInForeground) as? NSNumber,
let relativeDateKey = DataStore.shared().retrieve(key: CLRelativeDateKey) as? NSNumber, let relativeDateKey = DataStore.shared().retrieve(key: CLRelativeDateKey) as? NSNumber,
let showSecondsInMenubar = DataStore.shared().retrieve(key: CLShowSecondsInMenubar) as? NSNumber,
let fontSize = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber, let fontSize = DataStore.shared().retrieve(key: CLUserFontSizePreference) as? NSNumber,
let sunriseTime = DataStore.shared().retrieve(key: CLSunriseSunsetTime) as? NSNumber, let sunriseTime = DataStore.shared().retrieve(key: CLSunriseSunsetTime) as? NSNumber,
let showDayInMenu = DataStore.shared().retrieve(key: CLShowDayInMenu) as? NSNumber, let showDayInMenu = DataStore.shared().retrieve(key: CLShowDayInMenu) as? NSNumber,
@ -195,7 +194,6 @@ class PanelController: ParentPanelController {
"Display Future Slider": displayFutureSliderKey.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No", "Display Future Slider": displayFutureSliderKey.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No",
"Clocker mode": showAppInForeground.isEqual(to: NSNumber(value: 0)) ? "Menubar" : "Floating", "Clocker mode": showAppInForeground.isEqual(to: NSNumber(value: 0)) ? "Menubar" : "Floating",
"Relative Date": relativeDate, "Relative Date": relativeDate,
"Show Seconds in Menubar": showSecondsInMenubar.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No",
"Font Size": fontSize, "Font Size": fontSize,
"Sunrise Sunset": sunriseTime.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No", "Sunrise Sunset": sunriseTime.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No",
"Show Day in Menu": showDayInMenu.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No", "Show Day in Menu": showDayInMenu.isEqual(to: NSNumber(value: 0)) ? "Yes" : "No",

22
Clocker/Preferences/Appearance/AppearanceViewController.swift

@ -175,14 +175,20 @@ class AppearanceViewController: ParentViewController {
@IBAction func timeFormatSelectionChanged(_ sender: NSPopUpButton) { @IBAction func timeFormatSelectionChanged(_ sender: NSPopUpButton) {
let selection = NSNumber(value: sender.indexOfSelectedItem) let selection = NSNumber(value: sender.indexOfSelectedItem)
UserDefaults.standard.set(selection, forKey: CL24hourFormatSelectedKey) UserDefaults.standard.set(selection, forKey: CLSelectedTimeZoneFormatKey)
Logger.log(object: ["Time Format": sender.indexOfSelectedItem == 0 ? "12 Hour Format" : "24 Hour Format"], for: "Time Format Selected") Logger.log(object: ["Time Format": sender.indexOfSelectedItem == 0 ? "12 Hour Format" : "24 Hour Format"], for: "Time Format Selected")
refresh(panel: true, floating: true) refresh(panel: true, floating: true)
updateStatusItem() if let selectedFormat = sender.selectedItem?.title,
selectedFormat.contains("ss") {
print("Seconds are contained")
guard let panelController = PanelController.panel() else { return }
panelController.pauseTimer()
}
updateStatusItem()
previewPanelTableView.reloadData() previewPanelTableView.reloadData()
} }
@ -257,18 +263,6 @@ class AppearanceViewController: ParentViewController {
previewPanelTableView.reloadData() previewPanelTableView.reloadData()
} }
@IBAction func displayTimeWithSeconds(_ sender: NSSegmentedControl) {
Logger.log(object: ["Displayed": sender.selectedSegment == 0 ? "YES" : "NO"], for: "Display Time With Seconds")
if DataStore.shared().shouldDisplay(.seconds) {
guard let panelController = PanelController.panel() else { return }
panelController.pauseTimer()
}
updateStatusItem()
previewPanelTableView.reloadData()
}
@IBAction func changeAppDisplayOptions(_ sender: NSSegmentedControl) { @IBAction func changeAppDisplayOptions(_ sender: NSSegmentedControl) {
if sender.selectedSegment == 0 { if sender.selectedSegment == 0 {
Logger.log(object: ["Selection": "Menubar"], for: "Dock Mode") Logger.log(object: ["Selection": "Menubar"], for: "Dock Mode")

27
Clocker/Preferences/Preferences.storyboard

@ -411,7 +411,7 @@
<tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/> <tableColumnResizingMask key="resizingMask" resizeWithTable="YES" userResizable="YES"/>
<prototypeCellViews> <prototypeCellViews>
<tableCellView identifier="sourceCellView" misplaced="YES" id="yOO-gI-yD1" customClass="SourceTableViewCell" customModule="Clocker" customModuleProvider="target"> <tableCellView identifier="sourceCellView" misplaced="YES" id="yOO-gI-yD1" customClass="SourceTableViewCell" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="1" y="1" width="270" height="33"/> <rect key="frame" x="11" y="1" width="270" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="AIA-oD-PWu"> <textField verticalHuggingPriority="750" horizontalCompressionResistancePriority="250" translatesAutoresizingMaskIntoConstraints="NO" id="AIA-oD-PWu">
@ -434,7 +434,7 @@
</connections> </connections>
</tableCellView> </tableCellView>
<tableCellView identifier="calendarCellView" misplaced="YES" id="Guw-Ai-ICX" customClass="CalendarTableViewCell" customModule="Clocker" customModuleProvider="target"> <tableCellView identifier="calendarCellView" misplaced="YES" id="Guw-Ai-ICX" customClass="CalendarTableViewCell" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="1" y="36" width="270" height="33"/> <rect key="frame" x="11" y="36" width="270" height="33"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4c9-Nn-Umd"> <button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="4c9-Nn-Umd">
@ -860,12 +860,12 @@
<imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSFontPanel" id="yoa-s4-khY"/> <imageCell key="cell" refusesFirstResponder="YES" alignment="left" imageScaling="proportionallyDown" image="NSFontPanel" id="yoa-s4-khY"/>
</imageView> </imageView>
<segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DCB-IB-UxK"> <segmentedControl verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="DCB-IB-UxK">
<rect key="frame" x="243" y="249" width="64" height="24"/> <rect key="frame" x="243" y="249" width="138" height="24"/>
<segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="PZZ-H7-LgV"> <segmentedCell key="cell" borderStyle="border" alignment="left" style="rounded" trackingMode="selectOne" id="PZZ-H7-LgV">
<font key="font" size="12" name="Avenir-Light"/> <font key="font" size="12" name="Avenir-Light"/>
<segments> <segments>
<segment label="Yes"/> <segment label="Yes" width="36"/>
<segment label="No" selected="YES" tag="1"/> <segment label="No" width="36" selected="YES" tag="1"/>
</segments> </segments>
</segmentedCell> </segmentedCell>
<connections> <connections>
@ -909,11 +909,11 @@
</slider> </slider>
<scrollView borderType="line" autohidesScrollers="YES" horizontalLineScroll="113" horizontalPageScroll="10" verticalLineScroll="113" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ytg-0u-Mtu"> <scrollView borderType="line" autohidesScrollers="YES" horizontalLineScroll="113" horizontalPageScroll="10" verticalLineScroll="113" verticalPageScroll="10" hasHorizontalScroller="NO" hasVerticalScroller="NO" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="Ytg-0u-Mtu">
<rect key="frame" x="122" y="81" width="400" height="100"/> <rect key="frame" x="122" y="81" width="400" height="100"/>
<clipView key="contentView" id="gnX-f5-31D"> <clipView key="contentView" ambiguous="YES" id="gnX-f5-31D">
<rect key="frame" x="1" y="1" width="398" height="98"/> <rect key="frame" x="1" y="1" width="398" height="98"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="111" rowSizeStyle="automatic" viewBased="YES" id="KbJ-p4-i6E"> <tableView verticalHuggingPriority="750" ambiguous="YES" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" typeSelect="NO" rowHeight="111" rowSizeStyle="automatic" viewBased="YES" id="KbJ-p4-i6E">
<rect key="frame" x="0.0" y="0.0" width="398" height="113"/> <rect key="frame" x="0.0" y="0.0" width="398" height="113"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/> <size key="intercellSpacing" width="3" height="2"/>
@ -1146,6 +1146,7 @@
<constraint firstItem="wtO-uL-QBf" firstAttribute="top" secondItem="zFb-Gb-3dB" secondAttribute="top" constant="10" id="TUd-Wc-XZL"/> <constraint firstItem="wtO-uL-QBf" firstAttribute="top" secondItem="zFb-Gb-3dB" secondAttribute="top" constant="10" id="TUd-Wc-XZL"/>
<constraint firstItem="vrm-cg-RMn" firstAttribute="width" secondItem="wtO-uL-QBf" secondAttribute="width" multiplier="0.97" id="W8Z-wH-RJT"/> <constraint firstItem="vrm-cg-RMn" firstAttribute="width" secondItem="wtO-uL-QBf" secondAttribute="width" multiplier="0.97" id="W8Z-wH-RJT"/>
<constraint firstAttribute="trailing" secondItem="8IA-JL-fje" secondAttribute="trailing" constant="17" id="XEc-lD-5Pt"/> <constraint firstAttribute="trailing" secondItem="8IA-JL-fje" secondAttribute="trailing" constant="17" id="XEc-lD-5Pt"/>
<constraint firstItem="DCB-IB-UxK" firstAttribute="trailing" secondItem="9WW-jp-NeO" secondAttribute="trailing" id="YsG-fo-EQt"/>
<constraint firstItem="ZWy-WW-6H9" firstAttribute="top" secondItem="4lt-X6-3uU" secondAttribute="bottom" constant="20" id="Yup-JL-gtM"/> <constraint firstItem="ZWy-WW-6H9" firstAttribute="top" secondItem="4lt-X6-3uU" secondAttribute="bottom" constant="20" id="Yup-JL-gtM"/>
<constraint firstItem="xwt-pY-1w9" firstAttribute="top" secondItem="ZWy-WW-6H9" secondAttribute="bottom" constant="20" id="bFw-FZ-dB7"/> <constraint firstItem="xwt-pY-1w9" firstAttribute="top" secondItem="ZWy-WW-6H9" secondAttribute="bottom" constant="20" id="bFw-FZ-dB7"/>
<constraint firstItem="ZNm-TN-RRJ" firstAttribute="centerX" secondItem="zFb-Gb-3dB" secondAttribute="centerX" id="bWQ-fX-DZe"/> <constraint firstItem="ZNm-TN-RRJ" firstAttribute="centerX" secondItem="zFb-Gb-3dB" secondAttribute="centerX" id="bWQ-fX-DZe"/>
@ -1494,7 +1495,7 @@
<autoresizingMask key="autoresizingMask"/> <autoresizingMask key="autoresizingMask"/>
<subviews> <subviews>
<searchField toolTip="Search a timezone" wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dha-h9-Nd0" customClass="ClockerSearchField" customModule="Clocker" customModuleProvider="target"> <searchField toolTip="Search a timezone" wantsLayer="YES" focusRingType="none" verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="Dha-h9-Nd0" customClass="ClockerSearchField" customModule="Clocker" customModuleProvider="target">
<rect key="frame" x="8" y="157" width="320" height="23"/> <rect key="frame" x="8" y="133" width="320" height="23"/>
<searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" focusRingType="none" placeholderString="Enter a city, state, country name" usesSingleLineMode="YES" maximumRecents="5" id="ikU-Tm-0WZ"> <searchFieldCell key="cell" scrollable="YES" lineBreakMode="clipping" selectable="YES" editable="YES" borderStyle="bezel" focusRingType="none" placeholderString="Enter a city, state, country name" usesSingleLineMode="YES" maximumRecents="5" id="ikU-Tm-0WZ">
<font key="font" size="13" name="Avenir-Light"/> <font key="font" size="13" name="Avenir-Light"/>
<color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/> <color key="textColor" name="controlTextColor" catalog="System" colorSpace="catalog"/>
@ -1551,13 +1552,13 @@ DQ
</connections> </connections>
</button> </button>
<scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="32" horizontalPageScroll="10" verticalLineScroll="32" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0wY-ff-FLW"> <scrollView focusRingType="none" borderType="none" autohidesScrollers="YES" horizontalLineScroll="32" horizontalPageScroll="10" verticalLineScroll="32" verticalPageScroll="10" usesPredominantAxisScrolling="NO" translatesAutoresizingMaskIntoConstraints="NO" id="0wY-ff-FLW">
<rect key="frame" x="8" y="30" width="320" height="117"/> <rect key="frame" x="8" y="30" width="320" height="93"/>
<clipView key="contentView" drawsBackground="NO" id="rGc-3M-cCq"> <clipView key="contentView" drawsBackground="NO" id="rGc-3M-cCq">
<rect key="frame" x="0.0" y="0.0" width="320" height="117"/> <rect key="frame" x="0.0" y="0.0" width="320" height="93"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews> <subviews>
<tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="30" rowSizeStyle="automatic" viewBased="YES" id="xkl-2X-ZCb"> <tableView focusRingType="none" verticalHuggingPriority="750" allowsExpansionToolTips="YES" columnAutoresizingStyle="lastColumnOnly" multipleSelection="NO" emptySelection="NO" autosaveColumns="NO" rowHeight="30" rowSizeStyle="automatic" viewBased="YES" id="xkl-2X-ZCb">
<rect key="frame" x="0.0" y="0.0" width="320" height="117"/> <rect key="frame" x="0.0" y="0.0" width="320" height="93"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/> <autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<size key="intercellSpacing" width="3" height="2"/> <size key="intercellSpacing" width="3" height="2"/>
<color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/> <color key="backgroundColor" name="controlBackgroundColor" catalog="System" colorSpace="catalog"/>
@ -1647,14 +1648,14 @@ DQ
</scroller> </scroller>
</scrollView> </scrollView>
<progressIndicator wantsLayer="YES" focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="0A5-gp-lay"> <progressIndicator wantsLayer="YES" focusRingType="none" horizontalHuggingPriority="750" verticalHuggingPriority="750" maxValue="100" displayedWhenStopped="NO" bezeled="NO" indeterminate="YES" controlSize="small" style="spinning" translatesAutoresizingMaskIntoConstraints="NO" id="0A5-gp-lay">
<rect key="frame" x="160" y="108" width="16" height="16"/> <rect key="frame" x="160" y="96" width="16" height="16"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="16" id="fgE-77-Vda"/> <constraint firstAttribute="height" constant="16" id="fgE-77-Vda"/>
<constraint firstAttribute="width" constant="16" id="pwe-em-e0a"/> <constraint firstAttribute="width" constant="16" id="pwe-em-e0a"/>
</constraints> </constraints>
</progressIndicator> </progressIndicator>
<textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xgb-wU-8RU"> <textField verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="xgb-wU-8RU">
<rect key="frame" x="18" y="78" width="300" height="22"/> <rect key="frame" x="18" y="66" width="300" height="22"/>
<constraints> <constraints>
<constraint firstAttribute="height" constant="22" id="zqt-d8-yas"/> <constraint firstAttribute="height" constant="22" id="zqt-d8-yas"/>
</constraints> </constraints>

Loading…
Cancel
Save