Browse Source

Readability!

pull/113/head
Abhishek 3 years ago
parent
commit
0a9ad7eff4
  1. 5
      Clocker/Panel/ParentPanelController+ModernSlider.swift
  2. 3
      Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift
  3. 5
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift
  4. 5
      Clocker/Preferences/Calendar/CalendarViewController.swift

5
Clocker/Panel/ParentPanelController+ModernSlider.swift

@ -1,5 +1,6 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import AppKit
import CoreLoggerKit import CoreLoggerKit
import Foundation import Foundation
@ -11,7 +12,9 @@ extension ParentPanelController: NSCollectionViewDataSource {
} }
func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { 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) item.setup(with: indexPath.item)
return item return item
} }

3
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -1,5 +1,6 @@
// Copyright © 2015 Abhishek Banthia // Copyright © 2015 Abhishek Banthia
import AppKit
import Foundation import Foundation
class UpcomingEventViewItem: NSCollectionViewItem { class UpcomingEventViewItem: NSCollectionViewItem {
@ -88,7 +89,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
} }
func setupEmptyState() { 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"), setAlternateState(NSLocalizedString("No upcoming events for today!", comment: "Next Event Label with no upcoming event"),
subtitle, subtitle,

5
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -27,7 +27,10 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
} }
func collectionView(_ collectionView: NSCollectionView, itemForRepresentedObjectAt indexPath: IndexPath) -> NSCollectionViewItem { 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() { if eventCenter.calendarAccessNotDetermined() {
item.setupUndeterminedState(delegate) item.setupUndeterminedState(delegate)
return item return item

5
Clocker/Preferences/Calendar/CalendarViewController.swift

@ -117,7 +117,10 @@ class CalendarViewController: ParentViewController {
} }
private func onCalendarAccessDenial() { 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()) setGrantAccess(title: "Launch Preferences".localized())
// Remove upcoming event view if possible // Remove upcoming event view if possible

Loading…
Cancel
Save