refactor(calendar): open native url schemes from meeting buttons

Open conference meetings directly via native app URL schemes instead of routing through the browser. Adds native scheme support for Zoom, Teams, FaceTime, and Discord with fallback to HTTPS.
This commit is contained in:
Amir Zarrinkafsh 2026-04-07 21:23:09 +10:00
commit 93786b4a9c
No known key found for this signature in database
GPG key ID: ECDB8EF9E77E4EBF

View file

@ -1010,6 +1010,16 @@ enum ConferenceProvider: CaseIterable {
}
}
var nativeURLScheme: String? {
switch self {
case .zoom: return "zoommtg"
case .teams: return "msteams"
case .facetime: return "facetime"
case .discord: return "discord"
default: return nil
}
}
static func detect(from url: URL) -> ConferenceProvider {
let host = url.host?.lowercased() ?? ""
return allCases.first { provider in
@ -1035,7 +1045,17 @@ struct ConferenceJoinButton: View {
}
var body: some View {
Button(action: { openURL(url) }) {
Button(action: {
if let scheme = provider.nativeURLScheme,
var components = URLComponents(url: url, resolvingAgainstBaseURL: false) {
components.scheme = scheme
if let nativeURL = components.url {
openURL(nativeURL)
return
}
}
openURL(url)
}) {
HStack(spacing: 4) {
Image(systemName: "video.fill")
.font(.system(size: 9))