Browse Source

Some makeup.

pull/101/head
Abhishek 3 years ago
parent
commit
8cd3c8a55f
  1. 2
      Clocker/AppDelegate.swift
  2. 1
      Clocker/ClockerUITests/PermissionsTests.swift
  3. 4
      Clocker/ClockerUnitTests/StandardMenubarHandlerTests.swift
  4. 8
      Clocker/CoreModelKit/Sources/CoreModelKit/TimezoneData.swift
  5. 6
      Clocker/Dependencies/Date Additions/TimePeriodChain.swift
  6. 9
      Clocker/Events and Reminders/CalendarHandler.swift
  7. 3
      Clocker/Events and Reminders/RemindersHandler.swift
  8. 6
      Clocker/Menu Bar/StatusContainerView.swift
  9. 2
      Clocker/Onboarding/OnboardingSearchController.swift
  10. 9
      Clocker/Overall App/ConfigExport.swift
  11. 6
      Clocker/Panel/Notes Popover/NotesPopover.swift
  12. 3
      Clocker/Panel/PanelController.swift
  13. 24
      Clocker/Panel/ParentPanelController.swift
  14. 3
      Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift
  15. 14
      Clocker/Preferences/Appearance/AppearanceViewController.swift
  16. 6
      Clocker/Preferences/Calendar/CalendarViewController.swift
  17. 3
      Clocker/Preferences/General/PreferencesDataSource.swift
  18. 3
      Clocker/Preferences/General/PreferencesViewController.swift
  19. 6
      Clocker/Preferences/Menu Bar/StatusContainerView.swift
  20. 5
      Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

2
Clocker/AppDelegate.swift

@ -16,7 +16,7 @@ open class AppDelegate: NSObject, NSApplicationDelegate {
panelObserver?.invalidate() panelObserver?.invalidate()
} }
override open func observeValue(forKeyPath keyPath: String?, of object: Any?, change _: [NSKeyValueChangeKey: Any]?, context _: UnsafeMutableRawPointer?) { open override func observeValue(forKeyPath keyPath: String?, of object: Any?, change _: [NSKeyValueChangeKey: Any]?, context _: UnsafeMutableRawPointer?) {
if let path = keyPath, path == PreferencesConstants.hotKeyPathIdentifier { if let path = keyPath, path == PreferencesConstants.hotKeyPathIdentifier {
let hotKeyCenter = PTHotKeyCenter.shared() let hotKeyCenter = PTHotKeyCenter.shared()

1
Clocker/ClockerUITests/PermissionsTests.swift

@ -78,5 +78,4 @@ class PermissionsTests: XCTestCase {
return false return false
} }
} }
} }

4
Clocker/ClockerUnitTests/StandardMenubarHandlerTests.swift

@ -1,12 +1,11 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import XCTest
import CoreModelKit import CoreModelKit
import XCTest
@testable import Clocker @testable import Clocker
class StandardMenubarHandlerTests: XCTestCase { class StandardMenubarHandlerTests: XCTestCase {
private let mumbai = ["customLabel": "Ghar", private let mumbai = ["customLabel": "Ghar",
"formattedAddress": "Mumbai", "formattedAddress": "Mumbai",
"place_id": "ChIJwe1EZjDG5zsRaYxkjY_tpF0", "place_id": "ChIJwe1EZjDG5zsRaYxkjY_tpF0",
@ -75,5 +74,4 @@ class StandardMenubarHandlerTests: XCTestCase {
// Test menubar string is absent // Test menubar string is absent
XCTAssertTrue(menubarString.count == 0) XCTAssertTrue(menubarString.count == 0)
} }
} }

8
Clocker/CoreModelKit/Sources/CoreModelKit/TimezoneData.swift

@ -85,7 +85,7 @@ public class TimezoneData: NSObject, NSCoding {
public var isSystemTimezone = false public var isSystemTimezone = false
public var overrideFormat: TimezoneOverride = .globalFormat public var overrideFormat: TimezoneOverride = .globalFormat
override public init() { public override init() {
selectionType = .timezone selectionType = .timezone
isFavourite = 0 isFavourite = 0
note = ModelConstants.emptyString note = ModelConstants.emptyString
@ -277,7 +277,7 @@ public class TimezoneData: NSObject, NSCoding {
return formatInString.contains("ss") return formatInString.contains("ss")
} }
override public var hash: Int { public override var hash: Int {
guard let placeIdentifier = placeID, let timezone = timezoneID else { guard let placeIdentifier = placeID, let timezone = timezoneID else {
return -1 return -1
} }
@ -289,14 +289,14 @@ public class TimezoneData: NSObject, NSCoding {
return lhs.placeID == rhs.placeID return lhs.placeID == rhs.placeID
} }
override public func isEqual(to object: Any?) -> Bool { public override func isEqual(to object: Any?) -> Bool {
if let other = object as? TimezoneData { if let other = object as? TimezoneData {
return placeID == other.placeID return placeID == other.placeID
} }
return false return false
} }
override public func isEqual(_ object: Any?) -> Bool { public override func isEqual(_ object: Any?) -> Bool {
guard let compared = object as? TimezoneData else { guard let compared = object as? TimezoneData else {
return false return false
} }

6
Clocker/Dependencies/Date Additions/TimePeriodChain.swift

@ -138,15 +138,15 @@ open class TimePeriodChain: TimePeriodGroup {
_end = _end?.addingTimeInterval(duration) _end = _end?.addingTimeInterval(duration)
} }
override public func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] { public override func map<T>(_ transform: (TimePeriodProtocol) throws -> T) rethrows -> [T] {
return try periods.map(transform) return try periods.map(transform)
} }
override public func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] { public override func filter(_ isIncluded: (TimePeriodProtocol) throws -> Bool) rethrows -> [TimePeriodProtocol] {
return try periods.filter(isIncluded) return try periods.filter(isIncluded)
} }
override internal func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result { internal override func reduce<Result>(_ initialResult: Result, _ nextPartialResult: (Result, TimePeriodProtocol) throws -> Result) rethrows -> Result {
return try periods.reduce(initialResult, nextPartialResult) return try periods.reduce(initialResult, nextPartialResult)
} }

9
Clocker/Events and Reminders/CalendarHandler.swift

@ -176,7 +176,7 @@ extension EventCenter {
} }
// If there are no accepted events, prefer the first optional event // If there are no accepted events, prefer the first optional event
if acceptedEvents.isEmpty && !optionalEvents.isEmpty { if acceptedEvents.isEmpty, !optionalEvents.isEmpty {
return optionalEvents.first return optionalEvents.first
} }
@ -413,8 +413,7 @@ extension EventCenter {
|| actualLink.contains("indigo.collocall.de") || actualLink.contains("indigo.collocall.de")
|| actualLink.contains("public.senfcall.de") || actualLink.contains("public.senfcall.de")
|| actualLink.contains("youcanbook.me/zoom/") || actualLink.contains("youcanbook.me/zoom/")
|| actualLink.contains("workplace.com/groupcall") || actualLink.contains("workplace.com/groupcall") {
{
if let zoomLink = result.url { if let zoomLink = result.url {
return zoomLink return zoomLink
} }
@ -426,7 +425,7 @@ extension EventCenter {
private func retrieveMeetingURL(_ event: EKEvent) -> URL? { private func retrieveMeetingURL(_ event: EKEvent) -> URL? {
if EventCenter.dataDetector == nil { if EventCenter.dataDetector == nil {
var dataDetector: NSDataDetector? = nil var dataDetector: NSDataDetector?
do { do {
dataDetector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue) dataDetector = try NSDataDetector(types: NSTextCheckingResult.CheckingType.link.rawValue)
} catch { } catch {
@ -485,7 +484,7 @@ struct EventInfo {
func metadataForMeeting() -> String { func metadataForMeeting() -> String {
let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow
if (timeIntervalSinceNowForMeeting < 0 && timeIntervalSinceNowForMeeting > -300) { if timeIntervalSinceNowForMeeting < 0, timeIntervalSinceNowForMeeting > -300 {
return "started \(event.startDate.shortTimeAgoSinceNow) ago." return "started \(event.startDate.shortTimeAgoSinceNow) ago."
} else { } else {
let timeSince = Date().timeAgo(since: event.startDate) let timeSince = Date().timeAgo(since: event.startDate)

3
Clocker/Events and Reminders/RemindersHandler.swift

@ -51,8 +51,7 @@ extension EventCenter {
timezone: String, timezone: String,
alertIndex: Int, alertIndex: Int,
reminderDate: Date, reminderDate: Date,
additionalNotes: String?) -> Bool additionalNotes: String?) -> Bool {
{
initializeStoreIfNeccesary() initializeStoreIfNeccesary()
if reminderAccessNotDetermined() || reminderAccessDenied() { if reminderAccessNotDetermined() || reminderAccessDenied() {

6
Clocker/Menu Bar/StatusContainerView.swift

@ -31,12 +31,10 @@ func compactWidth(for timezone: TimezoneData) -> Int {
if timeFormat == DateFormat.twelveHour if timeFormat == DateFormat.twelveHour
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds
|| timeFormat == DateFormat.twelveHourWithZero || timeFormat == DateFormat.twelveHourWithZero
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds {
{
totalWidth += 20 totalWidth += 20
} else if timeFormat == DateFormat.twentyFourHour } else if timeFormat == DateFormat.twentyFourHour
|| timeFormat == DateFormat.twentyFourHourWithSeconds || timeFormat == DateFormat.twentyFourHourWithSeconds {
{
totalWidth += 0 totalWidth += 0
} }

2
Clocker/Onboarding/OnboardingSearchController.swift

@ -518,6 +518,6 @@ extension OnboardingSearchController: NSSearchFieldDelegate {
} }
func searchFieldDidEndSearching(_ sender: NSSearchField) { func searchFieldDidEndSearching(_ sender: NSSearchField) {
self.search(sender) search(sender)
} }
} }

9
Clocker/Overall App/ConfigExport.swift

@ -1,10 +1,9 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import Foundation
import CoreModelKit import CoreModelKit
import Foundation
struct ConfigExport { struct ConfigExport {
private func generateJSONFromDefaults() { private func generateJSONFromDefaults() {
let selectedKeys: Set<String> = Set([ let selectedKeys: Set<String> = Set([
CLShowOnboardingFlow, CLShowOnboardingFlow,
@ -30,7 +29,7 @@ struct ConfigExport {
CLDefaultMenubarMode, CLDefaultMenubarMode,
CLInstallHomeIndicatorObject, CLInstallHomeIndicatorObject,
CLSwitchToCompactModeAlert, CLSwitchToCompactModeAlert,
CLDisplayDSTTransitionInfo CLDisplayDSTTransitionInfo,
]) ])
let dictionaryRep = UserDefaults.standard.dictionaryRepresentation() let dictionaryRep = UserDefaults.standard.dictionaryRepresentation()
var clockerPrefs: [String: Any] = [:] var clockerPrefs: [String: Any] = [:]
@ -60,7 +59,7 @@ struct ConfigExport {
} }
let timezoneDict = ["Timezones": decodeJSON] let timezoneDict = ["Timezones": decodeJSON]
clockerPrefs.merge(timezoneDict) { (current, _) in current} clockerPrefs.merge(timezoneDict) { current, _ in current }
guard let documentDirectoryUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return } guard let documentDirectoryUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask).first else { return }
let fileUrl = documentDirectoryUrl.appendingPathComponent("Persons.json") let fileUrl = documentDirectoryUrl.appendingPathComponent("Persons.json")
@ -77,7 +76,5 @@ struct ConfigExport {
} catch { } catch {
print("Failure Observed \(error.localizedDescription)") print("Failure Observed \(error.localizedDescription)")
} }
} }
} }

6
Clocker/Panel/Notes Popover/NotesPopover.swift

@ -322,8 +322,7 @@ class NotesPopover: NSViewController {
} }
private func updateTimezoneInDefaultPreferences(with override: Int, private func updateTimezoneInDefaultPreferences(with override: Int,
_: OverrideType) _: OverrideType) {
{
let timezones = DataStore.shared().timezones() let timezones = DataStore.shared().timezones()
var timezoneObjects: [TimezoneData] = [] var timezoneObjects: [TimezoneData] = []
@ -392,8 +391,7 @@ class NotesPopover: NSViewController {
timezone: model.timezone(), timezone: model.timezone(),
alertIndex: alertIndex, alertIndex: alertIndex,
reminderDate: reminderPicker.dateValue, reminderDate: reminderPicker.dateValue,
additionalNotes: model.note) additionalNotes: model.note) {
{
showSuccessMessage() showSuccessMessage()
} }
} }

3
Clocker/Panel/PanelController.swift

@ -153,8 +153,7 @@ class PanelController: ParentPanelController {
} }
if let statusWindow = statusBackgroundWindow, if let statusWindow = statusBackgroundWindow,
let statusButton = statusView let statusButton = statusView {
{
var statusItemFrame = statusWindow.convertToScreen(statusButton.frame) var statusItemFrame = statusWindow.convertToScreen(statusButton.frame)
var statusItemScreen = NSScreen.main var statusItemScreen = NSScreen.main
var testPoint = statusItemFrame.origin var testPoint = statusItemFrame.origin

24
Clocker/Panel/ParentPanelController.swift

@ -434,8 +434,7 @@ class ParentPanelController: NSWindowController {
newHeight += 20 newHeight += 20
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo), } else if DataStore.shared().shouldDisplay(.dstTransitionInfo),
let obj = object, let obj = object,
TimezoneDataOperations(with: obj).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) != nil TimezoneDataOperations(with: obj).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) != nil {
{
newHeight += 20 newHeight += 20
} }
} }
@ -507,8 +506,6 @@ class ParentPanelController: NSWindowController {
scrollViewHeight.constant = (screenHeight() - 200) scrollViewHeight.constant = (screenHeight() - 200)
} }
} }
} }
} }
@ -625,8 +622,7 @@ class ParentPanelController: NSWindowController {
if $0 < mainTableView.numberOfRows, if $0 < mainTableView.numberOfRows,
let cellView = mainTableView.view(atColumn: 0, row: $0, makeIfNecessary: false) as? TimezoneCellView, let cellView = mainTableView.view(atColumn: 0, row: $0, makeIfNecessary: false) as? TimezoneCellView,
let model = TimezoneData.customObject(from: current) let model = TimezoneData.customObject(from: current) {
{
if let futureSliderCell = futureSlider.cell as? CustomSliderCell, futureSliderCell.tracking == true { if let futureSliderCell = futureSlider.cell as? CustomSliderCell, futureSliderCell.tracking == true {
return return
} }
@ -646,8 +642,7 @@ class ParentPanelController: NSWindowController {
if let note = model.note, !note.isEmpty { if let note = model.note, !note.isEmpty {
cellView.noteLabel.stringValue = note cellView.noteLabel.stringValue = note
} else if DataStore.shared().shouldDisplay(.dstTransitionInfo), } else if DataStore.shared().shouldDisplay(.dstTransitionInfo),
let value = TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) let value = TimezoneDataOperations(with: model).nextDaylightSavingsTransitionIfAvailable(with: futureSliderValue) {
{
cellView.noteLabel.stringValue = value cellView.noteLabel.stringValue = value
} else { } else {
cellView.noteLabel.stringValue = CLEmptyString cellView.noteLabel.stringValue = CLEmptyString
@ -752,8 +747,7 @@ class ParentPanelController: NSWindowController {
@IBAction func calendarButtonAction(_: NSButton) { @IBAction func calendarButtonAction(_: NSButton) {
if calendarButton.title == NSLocalizedString("Click here to start.", if calendarButton.title == NSLocalizedString("Click here to start.",
comment: "Button Title for no Calendar access") comment: "Button Title for no Calendar access") {
{
showPermissionsWindow() showPermissionsWindow()
} else { } else {
retrieveCalendarEvents() retrieveCalendarEvents()
@ -850,7 +844,6 @@ class ParentPanelController: NSWindowController {
return return
} }
guard let upcomingEvent = eventCenter.nextOccuring(events) else { guard let upcomingEvent = eventCenter.nextOccuring(events) else {
self.setPlaceholdersForUpcomingCalendarView() self.setPlaceholdersForUpcomingCalendarView()
if #available(OSX 10.14, *) { if #available(OSX 10.14, *) {
@ -882,9 +875,9 @@ class ParentPanelController: NSWindowController {
} }
} }
} else { } else {
if self.upcomingEventCollectionView != nil { if upcomingEventCollectionView != nil {
self.upcomingEventsDataSource.updateEventsDataSource([]) upcomingEventsDataSource.updateEventsDataSource([])
self.upcomingEventCollectionView.reloadData() upcomingEventCollectionView.reloadData()
return return
} }
@ -1154,8 +1147,7 @@ extension ParentPanelController: NSSharingServicePickerDelegate {
let timezones = DataStore.shared().timezones() let timezones = DataStore.shared().timezones()
stride(from: 0, to: timezones.count, by: 1).forEach { stride(from: 0, to: timezones.count, by: 1).forEach {
if $0 < mainTableView.numberOfRows, if $0 < mainTableView.numberOfRows,
let cellView = mainTableView.view(atColumn: 0, row: $0, makeIfNecessary: false) as? TimezoneCellView let cellView = mainTableView.view(atColumn: 0, row: $0, makeIfNecessary: false) as? TimezoneCellView {
{
clipboardCopy.append("\(cellView.customName.stringValue) - \(cellView.time.stringValue)\n") clipboardCopy.append("\(cellView.customName.stringValue) - \(cellView.time.stringValue)\n")
} }
} }

3
Clocker/Preferences/App Feedback/AppFeedbackWindowController.swift

@ -127,7 +127,7 @@ class AppFeedbackWindowController: NSWindowController {
let cleanedUpString = feedbackTextView.string.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines) let cleanedUpString = feedbackTextView.string.trimmingCharacters(in: CharacterSet.whitespacesAndNewlines)
if cleanedUpString.isEmpty { if cleanedUpString.isEmpty {
self.window?.contentView?.makeToast(AppFeedbackConstants.CLFeedbackNotEnteredErrorMessage) window?.contentView?.makeToast(AppFeedbackConstants.CLFeedbackNotEnteredErrorMessage)
isActivityInProgress = false isActivityInProgress = false
return false return false
} }
@ -178,7 +178,6 @@ class AppFeedbackWindowController: NSWindowController {
return """ return """
"Theme: \(themeInfo), "Display Future Slider": \(futureSlider), "Relative Date": \(relativeDate), "Country": \(country), "Timezones": \(selectedTimezones) "Theme: \(themeInfo), "Display Future Slider": \(futureSlider), "Relative Date": \(relativeDate), "Country": \(country), "Timezones": \(selectedTimezones)
""" """
} }
private func retrieveDataForSending() -> [String: String] { private func retrieveDataForSending() -> [String: String] {

14
Clocker/Preferences/Appearance/AppearanceViewController.swift

@ -63,9 +63,7 @@ class AppearanceViewController: ParentViewController {
"7 days", "7 days",
]) ])
if #available(macOS 11.0, *) { if #available(macOS 11.0, *) {} else {
} else {
theme.font = NSFont.systemFont(ofSize: 13) theme.font = NSFont.systemFont(ofSize: 13)
} }
@ -126,8 +124,7 @@ class AppearanceViewController: ParentViewController {
sliderDayRangePopup.selectItem(at: selectedIndex.intValue) sliderDayRangePopup.selectItem(at: selectedIndex.intValue)
} }
if #available(macOS 10.14, *) { if #available(macOS 10.14, *) {} else {
} else {
theme.removeItem(at: 2) theme.removeItem(at: 2)
} }
@ -153,7 +150,7 @@ class AppearanceViewController: ParentViewController {
@IBOutlet var menubarModeLabel: NSTextField! @IBOutlet var menubarModeLabel: NSTextField!
@IBOutlet var previewLabel: NSTextField! @IBOutlet var previewLabel: NSTextField!
@IBOutlet var miscelleaneousLabel: NSTextField! @IBOutlet var miscelleaneousLabel: NSTextField!
@IBOutlet weak var dstTransitionField: NSTextField! @IBOutlet var dstTransitionField: NSTextField!
// Panel Preview // Panel Preview
@IBOutlet var previewPanelTableView: NSTableView! @IBOutlet var previewPanelTableView: NSTableView!
@ -181,7 +178,7 @@ class AppearanceViewController: ParentViewController {
$0?.textColor = Themer.shared().mainTextColor() $0?.textColor = Themer.shared().mainTextColor()
} }
self.previewPanelTableView.backgroundColor = Themer.shared().mainBackgroundColor() previewPanelTableView.backgroundColor = Themer.shared().mainBackgroundColor()
} }
@IBAction func timeFormatSelectionChanged(_ sender: NSPopUpButton) { @IBAction func timeFormatSelectionChanged(_ sender: NSPopUpButton) {
@ -191,8 +188,7 @@ class AppearanceViewController: ParentViewController {
refresh(panel: true, floating: true) refresh(panel: true, floating: true)
if let selectedFormat = sender.selectedItem?.title, if let selectedFormat = sender.selectedItem?.title,
selectedFormat.contains("ss") selectedFormat.contains("ss") {
{
print("Seconds are contained") print("Seconds are contained")
guard let panelController = PanelController.panel() else { return } guard let panelController = PanelController.panel() else { return }
panelController.pauseTimer() panelController.pauseTimer()

6
Clocker/Preferences/Calendar/CalendarViewController.swift

@ -243,15 +243,13 @@ extension CalendarViewController: NSTableViewDelegate {
func tableView(_ tableView: NSTableView, viewFor _: NSTableColumn?, row: Int) -> NSView? { func tableView(_ tableView: NSTableView, viewFor _: NSTableColumn?, row: Int) -> NSView? {
if let currentSource = calendars[row] as? String, if let currentSource = calendars[row] as? String,
let message = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "sourceCellView"), owner: self) as? SourceTableViewCell let message = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "sourceCellView"), owner: self) as? SourceTableViewCell {
{
message.sourceName.stringValue = currentSource message.sourceName.stringValue = currentSource
return message return message
} }
if let currentSource = calendars[row] as? CalendarInfo, if let currentSource = calendars[row] as? CalendarInfo,
let calendarCell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "calendarCellView"), owner: self) as? CalendarTableViewCell let calendarCell = tableView.makeView(withIdentifier: NSUserInterfaceItemIdentifier(rawValue: "calendarCellView"), owner: self) as? CalendarTableViewCell {
{
calendarCell.calendarName.stringValue = currentSource.calendar.title calendarCell.calendarName.stringValue = currentSource.calendar.title
calendarCell.calendarSelected.state = currentSource.selected ? NSControl.StateValue.on : NSControl.StateValue.off calendarCell.calendarSelected.state = currentSource.selected ? NSControl.StateValue.on : NSControl.StateValue.off
calendarCell.calendarSelected.target = self calendarCell.calendarSelected.target = self

3
Clocker/Preferences/General/PreferencesDataSource.swift

@ -104,8 +104,7 @@ extension PreferencesDataSource: NSTableViewDataSource {
var selectedDataSource: TimezoneData? var selectedDataSource: TimezoneData?
if selectedTimezones.count > row, if selectedTimezones.count > row,
let model = TimezoneData.customObject(from: selectedTimezones[row]) let model = TimezoneData.customObject(from: selectedTimezones[row]) {
{
selectedDataSource = model selectedDataSource = model
} }

3
Clocker/Preferences/General/PreferencesViewController.swift

@ -340,8 +340,7 @@ extension PreferencesViewController: NSTableViewDataSource, NSTableViewDelegate
if let appDelegate = NSApplication.shared.delegate as? AppDelegate, if let appDelegate = NSApplication.shared.delegate as? AppDelegate,
let menubarFavourites = DataStore.shared().menubarTimezones(), let menubarFavourites = DataStore.shared().menubarTimezones(),
menubarFavourites.isEmpty, menubarFavourites.isEmpty,
DataStore.shared().shouldDisplay(.showMeetingInMenubar) == false DataStore.shared().shouldDisplay(.showMeetingInMenubar) == false {
{
appDelegate.invalidateMenubarTimer(true) appDelegate.invalidateMenubarTimer(true)
} }

6
Clocker/Preferences/Menu Bar/StatusContainerView.swift

@ -33,12 +33,10 @@ func compactWidth(for timezone: TimezoneData) -> Int {
if timeFormat == DateFormat.twelveHour if timeFormat == DateFormat.twelveHour
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds
|| timeFormat == DateFormat.twelveHourWithZero || timeFormat == DateFormat.twelveHourWithZero
|| timeFormat == DateFormat.twelveHourWithSeconds || timeFormat == DateFormat.twelveHourWithSeconds {
{
totalWidth += 20 totalWidth += 20
} else if timeFormat == DateFormat.twentyFourHour } else if timeFormat == DateFormat.twentyFourHour
|| timeFormat == DateFormat.twentyFourHourWithSeconds || timeFormat == DateFormat.twentyFourHourWithSeconds {
{
totalWidth += 0 totalWidth += 0
} }

5
Clocker/Preferences/Menu Bar/UpcomingEventStatusItemView.swift

@ -1,7 +1,7 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import Foundation
import AppKit import AppKit
import Foundation
class UpcomingEventStatusItemView: NSView { class UpcomingEventStatusItemView: NSView {
static let containerWidth = 70 static let containerWidth = 70
@ -13,6 +13,7 @@ class UpcomingEventStatusItemView: NSView {
initialSetup() initialSetup()
} }
} }
private var timeAttributes: [NSAttributedString.Key: AnyObject] { private var timeAttributes: [NSAttributedString.Key: AnyObject] {
let textColor = hasDarkAppearance ? NSColor.white : NSColor.black let textColor = hasDarkAppearance ? NSColor.white : NSColor.black
@ -64,7 +65,7 @@ class UpcomingEventStatusItemView: NSView {
]) ])
} }
required init?(coder: NSCoder) { required init?(coder _: NSCoder) {
fatalError("init(coder:) has not been implemented") fatalError("init(coder:) has not been implemented")
} }

Loading…
Cancel
Save