From fbc23c9e89c67e78a369fb396c0026155af8e518 Mon Sep 17 00:00:00 2001 From: Abhishek Banthia <8280282+n0shake@users.noreply.github.com> Date: Sun, 24 Mar 2024 18:56:31 -0400 Subject: [PATCH] Improve support for zoom / ms teams / chime meetings Borrowed from Itsycal. --- .../CalendarHandler.swift | 51 ++++++++++++++----- .../UpcomingEventsDataSource.swift | 2 +- 2 files changed, 39 insertions(+), 14 deletions(-) diff --git a/Clocker/Events and Reminders/CalendarHandler.swift b/Clocker/Events and Reminders/CalendarHandler.swift index 256b55f..363f519 100644 --- a/Clocker/Events and Reminders/CalendarHandler.swift +++ b/Clocker/Events and Reminders/CalendarHandler.swift @@ -350,6 +350,11 @@ extension EventCenter { if actualLink.contains("zoom.us/j/") || actualLink.contains("zoom.us/s/") || actualLink.contains("zoom.us/w/") + || actualLink.contains("zoom.us/my/") + || actualLink.contains("zoomgov.com/j/") + || actualLink.contains("zoomgov.com/s/") + || actualLink.contains("zoomgov.com/w/") + || actualLink.contains("zoomgov.com/my/") { // Create a Zoom App link let workspace = NSWorkspace.shared @@ -363,20 +368,39 @@ extension EventCenter { return appLink } } + } else if (actualLink.contains("teams.microsoft.com/l/meetup-join")) { + let workSpace = NSWorkspace.shared + if workSpace.urlForApplication(toOpen: URL(string:"msteams://")!) != nil { + let sanitizedString = actualLink.replacingOccurrences(of: "https://", with: "msteams://") + if let sanitizedURL = URL(string: sanitizedString) { + return sanitizedURL + } + } + } else if (actualLink.contains("chime.aws/")) { + let workSpace = NSWorkspace.shared + if workSpace.urlForApplication(toOpen: URL(string:"chime://")!) != nil { + let sanitizedString = actualLink.replacingOccurrences(of: "https://chime.aws/", with: "chime://meeting?pin=") + if let sanitizedURL = URL(string: sanitizedString) { + return sanitizedURL + } + } } else if actualLink.contains("zoommtg://") - || actualLink.contains("meet.google.com/") - || actualLink.contains("hangouts.google.com/") - || actualLink.contains("webex.com/") - || actualLink.contains("gotomeeting.com/join") - || actualLink.contains("ringcentral.com/j") - || actualLink.contains("bigbluebutton.org/gl") - || actualLink.contains("://bigbluebutton.") - || actualLink.contains("://bbb.") - || actualLink.contains("indigo.collocall.de") - || actualLink.contains("public.senfcall.de") - || actualLink.contains("youcanbook.me/zoom/") - || actualLink.contains("workplace.com/groupcall") - || actualLink.contains("bluejeans.com/") + || actualLink.contains("msteams://") + || actualLink.contains("chime://") + || actualLink.contains("meet.google.com/") + || actualLink.contains("hangouts.google.com/") + || actualLink.contains("webex.com/") + || actualLink.contains("gotomeeting.com/join") + || actualLink.contains("ringcentral.com/j") + || actualLink.contains("bigbluebutton.org/gl") + || actualLink.contains("https://bigbluebutton.") + || actualLink.contains("https://bbb.") + || actualLink.contains("https://meet.jit.si/") + || actualLink.contains("indigo.collocall.de") + || actualLink.contains("public.senfcall.de") + || actualLink.contains("facetime.apple.com/join") + || actualLink.contains("workplace.com/meet") + || actualLink.contains("youcanbook.me/zoom/") { if let meetingLink = result.url { return meetingLink @@ -404,6 +428,7 @@ extension EventCenter { } if let url = event.url { + print("--- URL exists \(url)") return findAppropriateURLs(url.absoluteString) } diff --git a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift index e2c2905..aac87c6 100644 --- a/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift +++ b/Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift @@ -62,7 +62,7 @@ class UpcomingEventsDataSource: NSObject, NSCollectionViewDataSource, NSCollecti let bufferWidth: CGFloat = currentEventInfo.meetingURL != nil ? 60.0 : 20.0 let longerString = currentEventInfo.event.title.count >= currentEventInfo.metadataForMeeting().count ? currentEventInfo.event.title : currentEventInfo.metadataForMeeting() let attributedString = NSAttributedString(string: longerString ?? CLEmptyString, attributes: [NSAttributedString.Key.font: avenirBookFont]) - let maxWidth = min(attributedString.size().width + bufferWidth, UpcomingEventsDataSource.panelWidth / 2) + let maxWidth = min((attributedString.size().width + 15) + bufferWidth, UpcomingEventsDataSource.panelWidth / 2) return NSSize(width: maxWidth, height: collectionView.frame.height - 20) } }