Browse Source

Minor changes for event display criteria.

pull/113/head
Abhishek Banthia 3 years ago
parent
commit
38b8e427a0
  1. 4
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 3
      Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift

4
Clocker/Events and Reminders/CalendarHandler.swift

@ -491,14 +491,14 @@ struct EventInfo {
func metadataForMeeting() -> String {
let timeIntervalSinceNowForMeeting = event.startDate.timeIntervalSinceNow
if timeIntervalSinceNowForMeeting < 0, timeIntervalSinceNowForMeeting > -300 {
return "started \(event.startDate.shortTimeAgoSinceNow) ago."
return "started +\(event.startDate.shortTimeAgoSinceNow)."
} else if event.startDate.isToday {
let timeSince = Date().timeAgo(since: event.startDate).lowercased()
let withoutAn = timeSince.replacingOccurrences(of: "an", with: CLEmptyString)
let withoutAgo = withoutAn.replacingOccurrences(of: "ago", with: CLEmptyString)
// If the user has not turned on seconds granularity for one of the timezones,
// we return "in 12 seconds" which looks weird.
return withoutAgo.contains("seconds") ? "started" : "in \(withoutAgo.lowercased())"
return withoutAgo.contains("seconds") ? "starts in <1m" : "in \(withoutAgo.lowercased())"
} else if event.startDate.isTomorrow {
let hoursUntil = event.startDate.hoursUntil
return "in \(hoursUntil)h"

3
Clocker/Preferences/Menu Bar/MenubarTitleProvider.swift

@ -50,7 +50,8 @@ class MenubarTitleProvider: NSObject {
}
for event in events {
if event.event.startDate.timeIntervalSinceNow > 0, !event.isAllDay {
let acceptableCriteria = event.event.startDate.timeIntervalSinceNow > -300
if acceptableCriteria, !event.isAllDay {
let timeForEventToStart = event.event.startDate.timeIntervalSinceNow / 60
if timeForEventToStart > 30 {

Loading…
Cancel
Save