Browse Source

Fix "Error" showing up.

master
Abhishek Banthia 9 months ago
parent
commit
c089fa6f03
  1. 6
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 4
      Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift

6
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)."

4
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 {

Loading…
Cancel
Save