Browse Source

Improve support for zoom / ms teams / chime meetings

Borrowed from Itsycal.
master
Abhishek Banthia 9 months ago
parent
commit
fbc23c9e89
  1. 51
      Clocker/Events and Reminders/CalendarHandler.swift
  2. 2
      Clocker/Panel/Upcoming Events/UpcomingEventsDataSource.swift

51
Clocker/Events and Reminders/CalendarHandler.swift

@ -350,6 +350,11 @@ extension EventCenter {
if actualLink.contains("zoom.us/j/") if actualLink.contains("zoom.us/j/")
|| actualLink.contains("zoom.us/s/") || actualLink.contains("zoom.us/s/")
|| actualLink.contains("zoom.us/w/") || 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 // Create a Zoom App link
let workspace = NSWorkspace.shared let workspace = NSWorkspace.shared
@ -363,20 +368,39 @@ extension EventCenter {
return appLink 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://") } else if actualLink.contains("zoommtg://")
|| actualLink.contains("meet.google.com/") || actualLink.contains("msteams://")
|| actualLink.contains("hangouts.google.com/") || actualLink.contains("chime://")
|| actualLink.contains("webex.com/") || actualLink.contains("meet.google.com/")
|| actualLink.contains("gotomeeting.com/join") || actualLink.contains("hangouts.google.com/")
|| actualLink.contains("ringcentral.com/j") || actualLink.contains("webex.com/")
|| actualLink.contains("bigbluebutton.org/gl") || actualLink.contains("gotomeeting.com/join")
|| actualLink.contains("://bigbluebutton.") || actualLink.contains("ringcentral.com/j")
|| actualLink.contains("://bbb.") || actualLink.contains("bigbluebutton.org/gl")
|| actualLink.contains("indigo.collocall.de") || actualLink.contains("https://bigbluebutton.")
|| actualLink.contains("public.senfcall.de") || actualLink.contains("https://bbb.")
|| actualLink.contains("youcanbook.me/zoom/") || actualLink.contains("https://meet.jit.si/")
|| actualLink.contains("workplace.com/groupcall") || actualLink.contains("indigo.collocall.de")
|| actualLink.contains("bluejeans.com/") || 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 { if let meetingLink = result.url {
return meetingLink return meetingLink
@ -404,6 +428,7 @@ extension EventCenter {
} }
if let url = event.url { if let url = event.url {
print("--- URL exists \(url)")
return findAppropriateURLs(url.absoluteString) return findAppropriateURLs(url.absoluteString)
} }

2
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 bufferWidth: CGFloat = currentEventInfo.meetingURL != nil ? 60.0 : 20.0
let longerString = currentEventInfo.event.title.count >= currentEventInfo.metadataForMeeting().count ? currentEventInfo.event.title : currentEventInfo.metadataForMeeting() 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 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) return NSSize(width: maxWidth, height: collectionView.frame.height - 20)
} }
} }

Loading…
Cancel
Save