From 72ccfd1e738da435311efc13451ef48f117afa6d Mon Sep 17 00:00:00 2001 From: bgjooon Date: Sun, 2 Jun 2024 15:55:59 -0700 Subject: [PATCH] feat: add support for zm.page links --- .../zm_page_icon.imageset/Contents.json | 12 ++++++++++++ .../zm_page_icon.imageset/zm_page_icon.svg | 1 + MeetingBar/MeetingServices.swift | 6 ++++++ MeetingBarTests/MeetingServicesTests.swift | 3 ++- MeetingBarTests/Meetingbar-sample-data.ics | 13 +++++++++++++ 5 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/Contents.json create mode 100644 MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/zm_page_icon.svg diff --git a/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/Contents.json b/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/Contents.json new file mode 100644 index 00000000..ecca3e20 --- /dev/null +++ b/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "zm_page_icon.svg", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/zm_page_icon.svg b/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/zm_page_icon.svg new file mode 100644 index 00000000..6ec823a7 --- /dev/null +++ b/MeetingBar/Assets.xcassets/vendor-icons/zm_page_icon.imageset/zm_page_icon.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/MeetingBar/MeetingServices.swift b/MeetingBar/MeetingServices.swift index d15fa324..e83e652d 100644 --- a/MeetingBar/MeetingServices.swift +++ b/MeetingBar/MeetingServices.swift @@ -76,6 +76,7 @@ enum MeetingServices: String, Codable, CaseIterable { case pumble = "Pumble" case suitConference = "Suit Conference" case doxyMe = "Doxy.me" + case zmPage = "zm.page" case other = "Other" var localizedValue: String { @@ -321,6 +322,7 @@ struct LinksRegex { let pumble = try! NSRegularExpression(pattern: #"https?://meet\.pumble\.com/[a-z-]+"#) let suitConference = try! NSRegularExpression(pattern: #"https?://([a-z0-9.]+)?conference\.istesuit\.com/[^\s]*+"#) let doxyMe = try! NSRegularExpression(pattern: #"https://([a-z0-9.]+)?doxy\.me/[^\s]*"#) + let zmPage = try! NSRegularExpression(pattern: #"https?://([a-zA-Z0-9.]+)\.zm\.page"#) } func getRegexForMeetingService(_ service: MeetingServices) -> NSRegularExpression? { @@ -607,6 +609,10 @@ func getIconForMeetingService(_ meetingService: MeetingServices?) -> NSImage { image = NSImage(named: "doxy_me_icon")! image.size = NSSize(width: 16, height: 16) + case .some(.zmPage): + image = NSImage(named: "zm_page_icon")! + image.size = NSSize(width: 16, height: 16) + // tested and verified case .none: image = NSImage(named: "no_online_session")! diff --git a/MeetingBarTests/MeetingServicesTests.swift b/MeetingBarTests/MeetingServicesTests.swift index 6fdf4d44..42063cd7 100644 --- a/MeetingBarTests/MeetingServicesTests.swift +++ b/MeetingBarTests/MeetingServicesTests.swift @@ -41,7 +41,8 @@ let meetings = [ MeetingLink(service: .tuple, url: URL(string: "https://tuple.app/c/V1StGXR8_Z5jdHi6B")!), MeetingLink(service: .pumble, url: URL(string: "https://meet.pumble.com/vly-hggs-xsn")!), MeetingLink(service: .suitConference, url: URL(string: "https://turkcell.conference.istesuit.com/username")!), - MeetingLink(service: .doxyMe, url: URL(string: "https://bbc.doxy.me/dr.who")!) + MeetingLink(service: .doxyMe, url: URL(string: "https://bbc.doxy.me/dr.who")!), + MeetingLink(service: .zmPage, url: URL(string: "https://meetingbar.zm.page")!) ] class MeetingServicesTests: XCTestCase { diff --git a/MeetingBarTests/Meetingbar-sample-data.ics b/MeetingBarTests/Meetingbar-sample-data.ics index 6b31fa3c..2e8385b0 100644 --- a/MeetingBarTests/Meetingbar-sample-data.ics +++ b/MeetingBarTests/Meetingbar-sample-data.ics @@ -409,4 +409,17 @@ DTSTART;TZID=Europe/Berlin:20201225T203000 SEQUENCE:1 DESCRIPTION:https://go.teamviewer.com/v15/m212323 END:VEVENT +BEGIN:VEVENT +CREATED:20240601T165407Z +UID:F012139F-5ED4-4617-8943-EBD0460D79ED +DTEND;TZID=Europe/Berlin:20240601T213000 +TRANSP:OPAQUE +X-APPLE-TRAVEL-ADVISORY-BEHAVIOR:AUTOMATIC +SUMMARY:ZM Page Test +LAST-MODIFIED:20240601T165434Z +DTSTAMP:20240601T165435Z +DTSTART;TZID=Europe/Berlin:20240601T203000 +SEQUENCE:1 +DESCRIPTION:https://meetingbar.zm.page +END:VEVENT END:VCALENDAR