mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
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:
parent
aecbe2ac35
commit
93786b4a9c
1 changed files with 21 additions and 1 deletions
|
|
@ -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 {
|
static func detect(from url: URL) -> ConferenceProvider {
|
||||||
let host = url.host?.lowercased() ?? ""
|
let host = url.host?.lowercased() ?? ""
|
||||||
return allCases.first { provider in
|
return allCases.first { provider in
|
||||||
|
|
@ -1035,7 +1045,17 @@ struct ConferenceJoinButton: View {
|
||||||
}
|
}
|
||||||
|
|
||||||
var body: some 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) {
|
HStack(spacing: 4) {
|
||||||
Image(systemName: "video.fill")
|
Image(systemName: "video.fill")
|
||||||
.font(.system(size: 9))
|
.font(.system(size: 9))
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue