Make Element Call widget URL configurable (#2971)

This commit is contained in:
Stefan Ceriu
2024-07-02 11:35:05 +03:00
committed by GitHub
parent 78b0c7068d
commit b2c9878df6
15 changed files with 342 additions and 114 deletions
@@ -38,9 +38,11 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
/// - callBaseURL: Which Element Call instance should be used
/// - clientID: Something to identify the current client on the Element Call side
init(elementCallService: ElementCallServiceProtocol,
clientProxy: ClientProxyProtocol,
roomProxy: RoomProxyProtocol,
callBaseURL: URL,
clientID: String) {
clientID: String,
elementCallBaseURL: URL,
elementCallBaseURLOverride: URL?) {
self.elementCallService = elementCallService
self.roomProxy = roomProxy
@@ -90,7 +92,15 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
.store(in: &cancellables)
Task {
switch await widgetDriver.start(baseURL: callBaseURL, clientID: clientID) {
let baseURL = if let elementCallBaseURLOverride {
elementCallBaseURLOverride
} else if case .success(let wellKnown) = await clientProxy.getElementWellKnown(), let wellKnownCall = wellKnown?.call {
wellKnownCall.widgetURL
} else {
elementCallBaseURL
}
switch await widgetDriver.start(baseURL: baseURL, clientID: clientID) {
case .success(let url):
state.url = url
case .failure(let error):