Browse Source

Update MenubarTitleProvider.swift

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
7352dd37e7
  1. 13
      Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift

13
Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift

@ -49,17 +49,18 @@ class MenubarTitleProvider: NSObject {
return nil return nil
} }
for event in events { for eventInfo in events {
let acceptableCriteria = event.event.startDate.timeIntervalSinceNow > -300 let event = eventInfo.event
if acceptableCriteria, !event.isAllDay { let acceptableCriteria = event.startDate.timeIntervalSinceNow > -300
let timeForEventToStart = event.event.startDate.timeIntervalSinceNow / 60 if acceptableCriteria, !eventInfo.isAllDay {
let timeForEventToStart = event.startDate.timeIntervalSinceNow / 60
if timeForEventToStart > 30 { if timeForEventToStart > 30 {
Logger.info("Our next event: \(event.event.title ?? "Error") starts in \(timeForEventToStart) mins") Logger.info("Our next event: \(event.title ?? "Error") starts in \(timeForEventToStart) mins")
continue continue
} }
return EventCenter.sharedCenter().format(event: event.event) return EventCenter.sharedCenter().format(event: event)
} }
} }
} }

Loading…
Cancel
Save