Browse Source

Return EventInfo instead of EKEvent.

pull/101/head
Abhishek 4 years ago
parent
commit
fa71c58ff4
  1. 6
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 8
      Clocker/Panel/ParentPanelController.swift

6
Clocker/Events and Reminders/CalendarHandler.swift

@ -150,7 +150,7 @@ extension EventCenter {
return menubarText return menubarText
} }
func nextOccuring(_: [EventInfo]) -> EKEvent? { func nextOccuring(_: [EventInfo]) -> EventInfo? {
if calendarAccessDenied() || calendarAccessNotDetermined() { if calendarAccessDenied() || calendarAccessNotDetermined() {
return nil return nil
} }
@ -162,14 +162,14 @@ extension EventCenter {
}.first }.first
if let firstEvent = filteredEvent { if let firstEvent = filteredEvent {
return firstEvent.event return firstEvent
} }
let filteredAllDayEvent = relevantEvents.filter { let filteredAllDayEvent = relevantEvents.filter {
$0.isAllDay $0.isAllDay
}.first }.first
return filteredAllDayEvent?.event return filteredAllDayEvent
} }
func initializeStoreIfNeccesary() { func initializeStoreIfNeccesary() {

8
Clocker/Panel/ParentPanelController.swift

@ -810,9 +810,9 @@ class ParentPanelController: NSWindowController {
return return
} }
self.calendarColorView.layer?.backgroundColor = upcomingEvent.calendar.color.cgColor self.calendarColorView.layer?.backgroundColor = upcomingEvent.event.calendar.color.cgColor
self.nextEventLabel.stringValue = upcomingEvent.title self.nextEventLabel.stringValue = upcomingEvent.event.title
self.nextEventLabel.toolTip = upcomingEvent.title self.nextEventLabel.toolTip = upcomingEvent.event.title
if upcomingEvent.isAllDay == true { if upcomingEvent.isAllDay == true {
let title = events.count == 1 ? "All-Day" : "All Day - Total \(events.count) events today" let title = events.count == 1 ? "All-Day" : "All Day - Total \(events.count) events today"
self.setCalendarButtonTitle(buttonTitle: title) self.setCalendarButtonTitle(buttonTitle: title)
@ -822,7 +822,7 @@ class ParentPanelController: NSWindowController {
return return
} }
let timeSince = Date().timeAgo(since: upcomingEvent.startDate) let timeSince = Date().timeAgo(since: upcomingEvent.event.startDate)
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)

Loading…
Cancel
Save