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:
Doug
2026-04-29 19:32:38 +01:00
committed by GitHub
parent dc26e9eb5c
commit 63592e48c1
19 changed files with 65 additions and 410 deletions
@@ -48,18 +48,10 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
self.analyticsService = analyticsService
isPictureInPictureAllowed = allowPictureInPicture
var isGenericCallLink = false
switch configuration.kind {
case .genericCallLink(let url):
widgetDriver = GenericCallLinkWidgetDriver(url: url)
isGenericCallLink = true
case .roomCall(let roomProxy, let clientProxy, _, _, _, _, _):
guard let deviceID = clientProxy.deviceID else { fatalError("Missing device ID for the call.") }
widgetDriver = roomProxy.elementCallWidgetDriver(deviceID: deviceID)
}
guard let deviceID = configuration.clientProxy.deviceID else { fatalError("Missing device ID for the call.") }
widgetDriver = configuration.roomProxy.elementCallWidgetDriver(deviceID: deviceID)
super.init(initialViewState: CallScreenViewState(script: CallScreenJavaScriptMessageName.allCasesInjectionScript,
isGenericCallLink: isGenericCallLink,
certificateValidator: appHooks.certificateValidatorHook))
elementCallService.actions
@@ -162,67 +154,60 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
}
private func setupCall() {
switch configuration.kind {
case .genericCallLink(let url):
state.url = url
// We need widget messaging to work before enabling CallKit, otherwise mute, hangup etc do nothing.
Task { [weak self] in
guard let self else { return }
case .roomCall(let roomProxy, _, let clientID, let voiceOnly, let elementCallBaseURL, let elementCallBaseURLOverride, let colorScheme):
Task { [weak self] in
guard let self else { return }
let baseURL = if let elementCallBaseURLOverride {
elementCallBaseURLOverride
} else {
elementCallBaseURL
}
// We only set the analytics configuration if analytics are enabled
let analyticsConfiguration: ElementCallAnalyticsConfiguration? = if analyticsService.isEnabled {
.init(posthogAPIHost: appSettings.elementCallPosthogAPIHost,
posthogAPIKey: appSettings.elementCallPosthogAPIKey,
sentryDSN: appSettings.elementCallPosthogSentryDSN)
} else {
nil
}
let rageshakeURL: String? = if case let .url(baseURL) = appSettings.bugReportRageshakeURL.publisher.value {
baseURL.absoluteString
} else {
nil
}
switch await widgetDriver.start(baseURL: baseURL,
clientID: clientID,
colorScheme: colorScheme,
voiceOnly: voiceOnly,
rageshakeURL: rageshakeURL,
analyticsConfiguration: analyticsConfiguration) {
case .success(let url):
state.url = url
case .failure(let error):
MXLog.error("Failed starting ElementCall Widget Driver with error: \(error)")
state.bindings.alertInfo = .init(id: UUID(),
title: L10n.errorUnknown,
primaryButton: .init(title: L10n.actionOk) {
self.actionsSubject.send(.dismiss)
})
return
}
await elementCallService.setupCallSession(roomID: roomProxy.id,
roomDisplayName: roomProxy.infoPublisher.value.displayName ?? roomProxy.id)
let baseURL = if let baseURLOverride = configuration.elementCallBaseURLOverride {
baseURLOverride
} else {
configuration.elementCallBaseURL
}
timeoutTask = Task { [weak self] in
try? await Task.sleep(for: .seconds(10))
guard !Task.isCancelled, let self else { return }
MXLog.error("Failed to join Element Call: Timeout")
// We only set the analytics configuration if analytics are enabled
let analyticsConfiguration: ElementCallAnalyticsConfiguration? = if analyticsService.isEnabled {
.init(posthogAPIHost: appSettings.elementCallPosthogAPIHost,
posthogAPIKey: appSettings.elementCallPosthogAPIKey,
sentryDSN: appSettings.elementCallPosthogSentryDSN)
} else {
nil
}
let rageshakeURL: String? = if case let .url(baseURL) = appSettings.bugReportRageshakeURL.publisher.value {
baseURL.absoluteString
} else {
nil
}
switch await widgetDriver.start(baseURL: baseURL,
clientID: configuration.clientID,
colorScheme: configuration.colorScheme,
voiceOnly: configuration.voiceOnly,
rageshakeURL: rageshakeURL,
analyticsConfiguration: analyticsConfiguration) {
case .success(let url):
state.url = url
case .failure(let error):
MXLog.error("Failed starting ElementCall Widget Driver with error: \(error)")
state.bindings.alertInfo = .init(id: UUID(),
title: L10n.commonError,
message: L10n.errorUnknown,
primaryButton: .init(title: L10n.actionDismiss) { [weak self] in self?.actionsSubject.send(.dismiss) })
timeoutTask = nil
title: L10n.errorUnknown,
primaryButton: .init(title: L10n.actionOk) {
self.actionsSubject.send(.dismiss)
})
return
}
await elementCallService.setupCallSession(roomID: configuration.roomProxy.id,
roomDisplayName: configuration.roomProxy.infoPublisher.value.displayName ?? configuration.roomProxy.id)
}
timeoutTask = Task { [weak self] in
try? await Task.sleep(for: .seconds(10))
guard !Task.isCancelled, let self else { return }
MXLog.error("Failed to join Element Call: Timeout")
state.bindings.alertInfo = .init(id: UUID(),
title: L10n.commonError,
message: L10n.errorUnknown,
primaryButton: .init(title: L10n.actionDismiss) { [weak self] in self?.actionsSubject.send(.dismiss) })
timeoutTask = nil
}
}