Prevent ElementX from intercepting links that it can't handle. Redirect them to the system browser
This commit is contained in:
committed by
Stefan Ceriu
parent
7eda122d20
commit
c6cba056e4
@@ -19,6 +19,7 @@ import SwiftUI
|
||||
@main
|
||||
struct Application: App {
|
||||
@UIApplicationDelegateAdaptor(AppDelegate.self) private var applicationDelegate
|
||||
@Environment(\.openURL) private var openURL
|
||||
private let appCoordinator: AppCoordinatorProtocol
|
||||
|
||||
init() {
|
||||
@@ -42,7 +43,11 @@ struct Application: App {
|
||||
|
||||
return .systemAction
|
||||
})
|
||||
.onOpenURL { appCoordinator.handleDeepLink($0) }
|
||||
.onOpenURL {
|
||||
if !appCoordinator.handleDeepLink($0) {
|
||||
openURL($0)
|
||||
}
|
||||
}
|
||||
.introspect(.window, on: .iOS(.v16)) { window in
|
||||
// Workaround for SwiftUI not consistently applying the tint colour to Alerts/Confirmation Dialogs.
|
||||
window.tintColor = .compound.textActionPrimary
|
||||
|
||||
@@ -83,6 +83,12 @@ struct ElementCallURLParser: URLParser {
|
||||
private let customSchemeURLQueryParameterName = "url"
|
||||
|
||||
func route(from url: URL) -> AppRoute? {
|
||||
// Element Call not supported, WebRTC not available
|
||||
// https://github.com/vector-im/element-x-ios/issues/1794
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return nil
|
||||
}
|
||||
|
||||
// First try processing URLs with custom schemes
|
||||
if let scheme = url.scheme,
|
||||
scheme == InfoPlistReader.app.elementCallScheme {
|
||||
|
||||
Reference in New Issue
Block a user