From c089fa6f0394692f10c3e4e2d90c328e66702909 Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Sat, 6 Apr 2024 11:59:48 -0400 Subject: [PATCH] Fix "Error" showing up. --- Clocker/Events and Reminders/CalendarHandler.swift | 6 ++++-- Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift | 4 +++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/Clocker/Events and Reminders/CalendarHandler.swift b/Clocker/Events and Reminders/CalendarHandler.swift index aee6830..f6890b7 100644 --- a/Clocker/Events and Reminders/CalendarHandler.swift +++ b/Clocker/Events and Reminders/CalendarHandler.swift @@ -122,7 +122,7 @@ extension EventCenter { let relevantEvents = filteredEvents[autoupdatingCalendar.startOfDay(for: Date())] ?? [] let filteredEvents = relevantEvents.filter { - $0.event.isAllDay == false && $0.event.endDate.timeIntervalSinceNow > 0 && $0.event.startDate.timeIntervalSinceNow > -300 + $0.event.isAllDay == false && $0.event.endDate.timeIntervalSinceNow > 0 && $0.event.startDate.timeIntervalSinceNow > -300 && $0.event.status != .canceled } if filteredEvents.count == 1 { return filteredEvents.first } @@ -474,7 +474,9 @@ struct EventInfo { func metadataForMeeting() -> String { let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow - if timeIntervalSinceNowForMeeting == 0 || event.startDate.shortTimeAgoSinceNow == "0s" { + + + if timeIntervalSinceNowForMeeting <= 0 || event.startDate.shortTimeAgoSinceNow == "0s" { return "started." } else if timeIntervalSinceNowForMeeting < 0, timeIntervalSinceNowForMeeting > -300 { return "started +\(event.startDate.shortTimeAgoSinceNow)." diff --git a/Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift b/Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift index 1a36310..805fc27 100644 --- a/Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift +++ b/Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift @@ -54,7 +54,9 @@ class MenubarTitleProvider: NSObject { for eventInfo in events { let event = eventInfo.event let acceptableCriteria = event.startDate.timeIntervalSinceNow > -300 - if acceptableCriteria, !eventInfo.isAllDay { + if acceptableCriteria, + !eventInfo.isAllDay, + eventInfo.event.status != EKEventStatus.canceled { let timeForEventToStart = event.startDate.timeIntervalSinceNow / 60 if timeForEventToStart > 30 {