mirror of
https://github.com/FBukovina/Atoll.git
synced 2026-10-27 15:14:33 +00:00
Merge pull request #399 from nightah/fix-meetings-uri
refactor(calendar): open native url schemes from meeting buttons
This commit is contained in:
commit
2193c28841
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