Browse Source

Formatting.

pull/101/head
Abhishek 3 years ago
parent
commit
6eab595a33
  1. 10
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 2
      Clocker/Panel/ParentPanelController.swift
  3. 2
      Clocker/Panel/Upcoming Events/ParentPanelController+UpcomingEvents.swift
  4. 10
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

10
Clocker/Events and Reminders/CalendarHandler.swift

@ -494,13 +494,13 @@ struct EventInfo {
return "in \(withoutAgo.lowercased())" return "in \(withoutAgo.lowercased())"
} else if event.startDate.isTomorrow { } else if event.startDate.isTomorrow {
let timeSince = event.startDate.shortTimeAgoSinceNow let timeSince = event.startDate.shortTimeAgoSinceNow
let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString) let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString)
let withoutAgo = withoutAn.replacingOccurrences(of: "ago", with: CLEmptyString) let withoutAgo = withoutAn.replacingOccurrences(of: "ago", with: CLEmptyString)
return "in \(withoutAgo.lowercased())" return "in \(withoutAgo.lowercased())"
} }
return "Error" return "Error"
} }
} }

2
Clocker/Panel/ParentPanelController.swift

@ -747,7 +747,7 @@ class ParentPanelController: NSWindowController {
@IBAction func calendarButtonAction(_ sender: NSButton) { @IBAction func calendarButtonAction(_ sender: NSButton) {
if sender.title == NSLocalizedString("Click here to start.", if sender.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()

2
Clocker/Panel/Upcoming Events/ParentPanelController+UpcomingEvents.swift

@ -17,7 +17,7 @@ protocol UpcomingEventPanelDelegate: AnyObject {
extension ParentPanelController { extension ParentPanelController {
func setupUpcomingEventViewCollectionViewIfNeccesary() { func setupUpcomingEventViewCollectionViewIfNeccesary() {
if upcomingEventCollectionView != nil { if upcomingEventCollectionView != nil {
upcomingEventsDataSource = UpcomingEventsDataSource(self, EventCenter.sharedCenter()) upcomingEventsDataSource = UpcomingEventsDataSource(self, EventCenter.sharedCenter())
upcomingEventCollectionView.enclosingScrollView?.scrollerInsets = NSEdgeInsetsZero upcomingEventCollectionView.enclosingScrollView?.scrollerInsets = NSEdgeInsetsZero
upcomingEventCollectionView.enclosingScrollView?.backgroundColor = NSColor.clear upcomingEventCollectionView.enclosingScrollView?.backgroundColor = NSColor.clear
upcomingEventCollectionView.setAccessibility("UpcomingEventCollectionView") upcomingEventCollectionView.setAccessibility("UpcomingEventCollectionView")

10
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -7,7 +7,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
private var eventCenter: EventCenter! private var eventCenter: EventCenter!
private weak var delegate: UpcomingEventPanelDelegate? private weak var delegate: UpcomingEventPanelDelegate?
init(_ panelDelegate: UpcomingEventPanelDelegate?, _ center: EventCenter) { init(_ panelDelegate: UpcomingEventPanelDelegate?, _ center: EventCenter) {
super.init() super.init()
delegate = panelDelegate delegate = panelDelegate
eventCenter = center eventCenter = center
@ -18,7 +18,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
} }
func collectionView(_: NSCollectionView, numberOfItemsInSection _: Int) -> Int { func collectionView(_: NSCollectionView, numberOfItemsInSection _: Int) -> Int {
if eventCenter.calendarAccessDenied() || eventCenter.calendarAccessNotDetermined() || upcomingEvents.isEmpty { if eventCenter.calendarAccessDenied() || eventCenter.calendarAccessNotDetermined() || upcomingEvents.isEmpty {
return 1 return 1
} }
return upcomingEvents.count return upcomingEvents.count
@ -27,8 +27,8 @@ 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 let item = collectionView.makeItem(withIdentifier: UpcomingEventViewItem.reuseIdentifier, for: indexPath) as! UpcomingEventViewItem
if eventCenter.calendarAccessNotDetermined() { if eventCenter.calendarAccessNotDetermined() {
item.setupUndeterminedState(delegate) item.setupUndeterminedState(delegate)
return item return item
} }
if upcomingEvents.isEmpty { if upcomingEvents.isEmpty {
@ -44,7 +44,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
} }
func collectionView(_ collectionView: NSCollectionView, layout _: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize { func collectionView(_ collectionView: NSCollectionView, layout _: NSCollectionViewLayout, sizeForItemAt indexPath: IndexPath) -> NSSize {
if upcomingEvents.isEmpty || eventCenter.calendarAccessNotDetermined() { if upcomingEvents.isEmpty || eventCenter.calendarAccessNotDetermined() {
return NSSize(width: collectionView.frame.width - 20, height: 50) return NSSize(width: collectionView.frame.width - 20, height: 50)
} }

Loading…
Cancel
Save