Browse Source

Formatting.

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

12
Clocker/Events and Reminders/CalendarHandler.swift

@ -494,13 +494,13 @@ struct EventInfo {
return "in \(withoutAgo.lowercased())"
} else if event.startDate.isTomorrow {
let timeSince = event.startDate.shortTimeAgoSinceNow
let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString)
let withoutAgo = withoutAn.replacingOccurrences(of: "ago", with: CLEmptyString)
let timeSince = event.startDate.shortTimeAgoSinceNow
let withoutAn = timeSince.replacingOccurrences(of: "an", 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) {
if sender.title == NSLocalizedString("Click here to start.",
comment: "Button Title for no Calendar access") {
comment: "Button Title for no Calendar access") {
showPermissionsWindow()
} else {
retrieveCalendarEvents()

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

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

2
Clocker/Panel/Upcoming Events/UpcomingEventViewItem.swift

@ -50,7 +50,7 @@ class UpcomingEventViewItem: NSCollectionViewItem {
zoomButton.image = Themer.shared().removeImage()
panelDelegate = delegate
}
func setupEmptyState() {
if leadingConstraint.constant != 10 {
leadingConstraint.constant = 10

12
Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

@ -7,7 +7,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
private var eventCenter: EventCenter!
private weak var delegate: UpcomingEventPanelDelegate?
init(_ panelDelegate: UpcomingEventPanelDelegate?, _ center: EventCenter) {
init(_ panelDelegate: UpcomingEventPanelDelegate?, _ center: EventCenter) {
super.init()
delegate = panelDelegate
eventCenter = center
@ -18,7 +18,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
}
func collectionView(_: NSCollectionView, numberOfItemsInSection _: Int) -> Int {
if eventCenter.calendarAccessDenied() || eventCenter.calendarAccessNotDetermined() || upcomingEvents.isEmpty {
if eventCenter.calendarAccessDenied() || eventCenter.calendarAccessNotDetermined() || upcomingEvents.isEmpty {
return 1
}
return upcomingEvents.count
@ -27,10 +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
if eventCenter.calendarAccessNotDetermined() {
item.setupUndeterminedState(delegate)
return item
item.setupUndeterminedState(delegate)
return item
}
if upcomingEvents.isEmpty {
item.setupEmptyState()
return item
@ -44,7 +44,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti
}
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)
}

Loading…
Cancel
Save