mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 12:07:55 +00:00
Remove support for handling SPA calls within the app. (#5515)
* Remove support for handling SPA call links. They were a stop-gap solution whilst we were building support for embedded room calling. * Simplify ElementCallConfiguration now that there is only 1 type of call to handle. * Remove the unused overlayModule from NavigationRoomCoordinator.
This commit is contained in:
@@ -41,8 +41,6 @@ enum AppRoute: Hashable {
|
||||
case userProfile(userID: String)
|
||||
/// An Element Call running in a particular room
|
||||
case call(roomID: String, isVoiceCall: Bool)
|
||||
/// An Element Call link generated outside of a chat room.
|
||||
case genericCallLink(url: URL)
|
||||
/// The settings screen.
|
||||
case settings
|
||||
/// The setting screen for key backup.
|
||||
@@ -84,8 +82,7 @@ struct AppRouteURLParser {
|
||||
AppGroupURLParser(),
|
||||
MatrixPermalinkParser(),
|
||||
ElementWebURLParser(domains: appSettings.elementWebHosts),
|
||||
AccountProvisioningURLParser(domain: appSettings.accountProvisioningHost),
|
||||
ElementCallURLParser()
|
||||
AccountProvisioningURLParser(domain: appSettings.accountProvisioningHost)
|
||||
]
|
||||
}
|
||||
|
||||
@@ -135,45 +132,6 @@ private struct AppGroupURLParser: URLParser {
|
||||
}
|
||||
}
|
||||
|
||||
/// The parser for Element Call links. This always returns a `.genericCallLink`.
|
||||
private struct ElementCallURLParser: URLParser {
|
||||
private let knownHosts = ["call.element.io"]
|
||||
private let customSchemeURLQueryParameterName = "url"
|
||||
|
||||
func route(from url: URL) -> AppRoute? {
|
||||
// Element Call not supported, WebRTC not available
|
||||
// https://github.com/element-hq/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 {
|
||||
guard let components = URLComponents(url: url, resolvingAgainstBaseURL: false) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
guard let encodedURLString = components.queryItems?.first(where: { $0.name == customSchemeURLQueryParameterName })?.value,
|
||||
let callURL = URL(string: encodedURLString),
|
||||
callURL.scheme == "https" // Don't allow URLs from potentially unsafe domains
|
||||
else {
|
||||
MXLog.error("Invalid custom scheme call parameters: \(url)")
|
||||
return nil
|
||||
}
|
||||
|
||||
return .genericCallLink(url: callURL)
|
||||
}
|
||||
|
||||
// Otherwise try to interpret it as an universal link
|
||||
guard let host = url.host, knownHosts.contains(host) else {
|
||||
return nil
|
||||
}
|
||||
|
||||
return .genericCallLink(url: url)
|
||||
}
|
||||
}
|
||||
|
||||
private struct MatrixPermalinkParser: URLParser {
|
||||
func route(from url: URL) -> AppRoute? {
|
||||
guard let entity = parseMatrixEntityFrom(uri: url.absoluteString) else { return nil }
|
||||
|
||||
@@ -48,25 +48,6 @@ import SwiftUI
|
||||
sheetModule?.coordinator
|
||||
}
|
||||
|
||||
fileprivate var overlayModule: NavigationModule? {
|
||||
didSet {
|
||||
if let oldValue {
|
||||
logPresentationChange("Remove overlay", oldValue)
|
||||
oldValue.tearDown()
|
||||
}
|
||||
|
||||
if let overlayModule {
|
||||
logPresentationChange("Set overlay", overlayModule)
|
||||
overlayModule.coordinator?.start()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// The currently displayed overlay coordinator
|
||||
var overlayCoordinator: (any CoordinatorProtocol)? {
|
||||
overlayModule?.coordinator
|
||||
}
|
||||
|
||||
/// The lowest-level `AlertInfo`, directly available to the root of the app.
|
||||
var alertInfo: AlertInfo<UUID>?
|
||||
|
||||
@@ -104,31 +85,6 @@ import SwiftUI
|
||||
sheetModule = NavigationModule(coordinator, dismissalCallback: dismissalCallback)
|
||||
}
|
||||
}
|
||||
|
||||
/// Present an overlay on top of the split view
|
||||
/// - Parameters:
|
||||
/// - coordinator: the coordinator to display
|
||||
/// - animated: whether the transition should be animated
|
||||
/// - dismissalCallback: called when the overlay has been dismissed, programatically or otherwise
|
||||
func setOverlayCoordinator(_ coordinator: (any CoordinatorProtocol)?,
|
||||
animated: Bool = true,
|
||||
dismissalCallback: (() -> Void)? = nil) {
|
||||
guard let coordinator else {
|
||||
overlayModule = nil
|
||||
return
|
||||
}
|
||||
|
||||
if overlayModule?.coordinator === coordinator {
|
||||
fatalError("Cannot use the same coordinator more than once")
|
||||
}
|
||||
|
||||
var transaction = Transaction()
|
||||
transaction.disablesAnimations = !animated
|
||||
|
||||
withTransaction(transaction) {
|
||||
overlayModule = NavigationModule(coordinator, dismissalCallback: dismissalCallback)
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - CoordinatorProtocol
|
||||
|
||||
@@ -167,15 +123,5 @@ private struct NavigationRootCoordinatorView: View {
|
||||
.sheet(item: $rootCoordinator.sheetModule) { module in
|
||||
module.coordinator?.toPresentable()
|
||||
}
|
||||
.accessibilityHidden(rootCoordinator.overlayModule?.coordinator != nil)
|
||||
.overlay {
|
||||
Group {
|
||||
if let coordinator = rootCoordinator.overlayModule?.coordinator {
|
||||
coordinator.toPresentable()
|
||||
.transition(.opacity)
|
||||
}
|
||||
}
|
||||
.animation(.elementDefault, value: rootCoordinator.overlayModule)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user