Skip to content

Commit

Permalink
Readability!
Browse files Browse the repository at this point in the history
  • Loading branch information
n0shake committed Apr 16, 2022
1 parent 33623d4 commit 0a9ad7e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 4 deletions.
5 changes: 4 additions & 1 deletion Clocker/Panel/ParentPanelController+ModernSlider.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright © 2015 Abhishek Banthia

import AppKit
import CoreLoggerKit
import Foundation

Expand All @@ -11,7 +12,9 @@ extension ParentPanelController: NSCollectionViewDataSource {
}

func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = collectionView.makeItem(withIdentifier: TimeMarkerViewItem.reuseIdentifier, for: indexPath) as! TimeMarkerViewItem
guard let item = collectionView.makeItem(withIdentifier: TimeMarkerViewItem.reuseIdentifier, for: indexPath) as? TimeMarkerViewItem else {
return NSCollectionViewItem()
}
item.setup(with: indexPath.item)
return item
}
Expand Down
3 changes: 2 additions & 1 deletion Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Copyright © 2015 Abhishek Banthia

import AppKit
import Foundation

class UpcomingEventViewItem: NSCollectionViewItem {
Expand Down Expand Up @@ -88,7 +89,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
}

func setupEmptyState() {
let subtitle = NSCalendar.autoupdatingCurrent.isDateInWeekend(Date()) ? NSLocalizedString("Happy Weekend.", comment: "Button Title for no upcoming event") : NSLocalizedString("Great going.", comment: "Button Title for no upcoming event")
let subtitle = NSCalendar.autoupdatingCurrent.isDateInWeekend(Date()) ? "Happy Weekend.".localized() : "Great going.".localized()

setAlternateState(NSLocalizedString("No upcoming events for today!", comment: "Next Event Label with no upcoming event"),
subtitle,
Expand Down
5 changes: 4 additions & 1 deletion Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,10 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
}

func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem {
let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as! UpcomingEventViewItem
guard let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as? UpcomingEventViewItem else {
assertionFailure("Unable to make UpcomingEventViewItem")
return NSCollectionViewItem()
}
if eventCenter.calendarAccessNotDetermined() {
item.setupUndeterminedState(delegate)
return item
Expand Down
5 changes: 4 additions & 1 deletion Clocker/Preferences/Calendar/CalendarViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,10 @@ class CalendarViewController: ParentViewController {
}

private func onCalendarAccessDenial() {
informationField.stringValue = "Clocker is more useful when it can display events from your calendars. You can change this setting in System Preferences › Security & Privacy › Privacy.".localized()
informationField.stringValue = """
Clocker is more useful when it can display events from your calendars.
You can change this setting in System Preferences › Security & Privacy › Privacy.
""".localized()
setGrantAccess(title: "Launch Preferences".localized())

// Remove upcoming event view if possible
Expand Down

0 comments on commit 0a9ad7e

Please sign in to comment.