mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 10:33:45 +00:00
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
a05c3e3774
commit
68ea9acb36
@@ -19,6 +19,7 @@ import SwiftUI
|
|||||||
@main
|
@main
|
||||||
struct Application: App {
|
struct Application: App {
|
||||||
@UIApplicationDelegateAdaptor(AppDelegate.self) private var applicationDelegate
|
@UIApplicationDelegateAdaptor(AppDelegate.self) private var applicationDelegate
|
||||||
|
@Environment(\.openURL) private var openURL
|
||||||
private let appCoordinator: AppCoordinatorProtocol
|
private let appCoordinator: AppCoordinatorProtocol
|
||||||
|
|
||||||
init() {
|
init() {
|
||||||
@@ -42,7 +43,11 @@ struct Application: App {
|
|||||||
|
|
||||||
return .systemAction
|
return .systemAction
|
||||||
})
|
})
|
||||||
.onOpenURL { appCoordinator.handleDeepLink($0) }
|
.onOpenURL {
|
||||||
|
if !appCoordinator.handleDeepLink($0) {
|
||||||
|
openURL($0)
|
||||||
|
}
|
||||||
|
}
|
||||||
.introspect(.window, on: .iOS(.v16)) { window in
|
.introspect(.window, on: .iOS(.v16)) { window in
|
||||||
// Workaround for SwiftUI not consistently applying the tint colour to Alerts/Confirmation Dialogs.
|
// Workaround for SwiftUI not consistently applying the tint colour to Alerts/Confirmation Dialogs.
|
||||||
window.tintColor = .compound.textActionPrimary
|
window.tintColor = .compound.textActionPrimary
|
||||||
|
|||||||
@@ -83,6 +83,12 @@ struct ElementCallURLParser: URLParser {
|
|||||||
private let customSchemeURLQueryParameterName = "url"
|
private let customSchemeURLQueryParameterName = "url"
|
||||||
|
|
||||||
func route(from url: URL) -> AppRoute? {
|
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
|
// First try processing URLs with custom schemes
|
||||||
if let scheme = url.scheme,
|
if let scheme = url.scheme,
|
||||||
scheme == InfoPlistReader.app.elementCallScheme {
|
scheme == InfoPlistReader.app.elementCallScheme {
|
||||||
|
|||||||
Reference in New Issue
Block a user