generated from element-hq/.github
-
Notifications
You must be signed in to change notification settings - Fork 73
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Generic element call link support (#1643)
* Remove swift-url-routing and replace it with a custom implementation. It fails parsing the fragments in app.element.io links and it doesn't bring any value * Add handling for opening generic element call links * Add applinks support for call.element.io * Enable VoIP and Audio playback background modes
- Loading branch information
1 parent
9022837
commit 62b6cd5
Showing
15 changed files
with
298 additions
and
146 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
// | ||
// Copyright 2023 New Vector Ltd | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
|
||
import Foundation | ||
|
||
enum AppRoute: Equatable { | ||
case roomList | ||
case room(roomID: String) | ||
case roomDetails(roomID: String) | ||
case invites | ||
case genericCallLink(url: URL) | ||
} | ||
|
||
enum AppRouteURLParser { | ||
private enum KnownHosts: String, CaseIterable { | ||
case elementIo = "element.io" | ||
case appElementIo = "app.element.io" | ||
case stagingElementIo = "staging.element.io" | ||
case developElementIo = "develop.element.io" | ||
case mobileElementIo = "mobile.element.io" | ||
case callElementIo = "call.element.io" | ||
} | ||
|
||
static func route(from url: URL) -> AppRoute? { | ||
guard let urlComponents = URLComponents(url: url, resolvingAgainstBaseURL: false), | ||
let host = urlComponents.host else { | ||
MXLog.error("Failed parsing URL: \(url)") | ||
return nil | ||
} | ||
|
||
guard KnownHosts.allCases.map(\.rawValue).contains(host) else { | ||
return .genericCallLink(url: url) | ||
} | ||
|
||
if host == KnownHosts.callElementIo.rawValue { | ||
return .genericCallLink(url: url) | ||
} | ||
|
||
// Deep linking not supported at the moment | ||
return nil | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.