Expose Element Call settings in the developer options. Start using th… (#2039)

* Expose Element Call settings in the developer options. Start using the encryption widget parameter.

* Remove the Element Call feature flag
This commit is contained in:
Stefan Ceriu
2023-11-07 16:12:03 +02:00
committed by GitHub
parent b13abf9cdf
commit 5dcb24add7
13 changed files with 76 additions and 56 deletions
@@ -23,6 +23,8 @@ struct CallScreenCoordinatorParameters {
let callBaseURL: URL
/// A way to identify the current client against Element Call
let clientID: String
/// Whether encryption should be used within the call
let useEncryption: Bool
}
enum CallScreenCoordinatorAction {
@@ -44,7 +46,8 @@ final class CallScreenCoordinator: CoordinatorProtocol {
viewModel = CallScreenViewModel(roomProxy: parameters.roomProxy,
callBaseURL: parameters.callBaseURL,
clientID: parameters.clientID)
clientID: parameters.clientID,
useEncryption: parameters.useEncryption)
}
func start() {
@@ -46,7 +46,10 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
/// - roomProxy: The room in which the call should be created
/// - callBaseURL: Which Element Call instance should be used
/// - clientID: Something to identify the current client on the Element Call side
init(roomProxy: RoomProxyProtocol, callBaseURL: URL, clientID: String) {
init(roomProxy: RoomProxyProtocol,
callBaseURL: URL,
clientID: String,
useEncryption: Bool) {
self.roomProxy = roomProxy
self.callBaseURL = callBaseURL
self.clientID = clientID
@@ -99,7 +102,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
.store(in: &cancellables)
Task {
switch await widgetDriver.start(baseURL: callBaseURL, clientID: clientID) {
switch await widgetDriver.start(baseURL: callBaseURL, clientID: clientID, useEncryption: useEncryption) {
case .success(let url):
state.url = url
case .failure(let error):
@@ -23,8 +23,6 @@ struct CallScreen: View {
var body: some View {
WebView(url: context.viewState.url, viewModelContext: context)
.navigationTitle("Call")
.navigationBarTitleDisplayMode(.inline)
.ignoresSafeArea(edges: .bottom)
.presentationDragIndicator(.visible)
.environment(\.colorScheme, .dark)
@@ -164,13 +162,14 @@ struct CallScreen_Previews: PreviewProvider {
let widgetDriver = ElementCallWidgetDriverMock()
widgetDriver.underlyingMessagePublisher = .init()
widgetDriver.underlyingActions = PassthroughSubject<ElementCallWidgetDriverAction, Never>().eraseToAnyPublisher()
widgetDriver.startBaseURLClientIDReturnValue = .success(URL.userDirectory)
widgetDriver.startBaseURLClientIDUseEncryptionReturnValue = .success(URL.userDirectory)
roomProxy.elementCallWidgetDriverReturnValue = widgetDriver
return CallScreenViewModel(roomProxy: roomProxy,
callBaseURL: "https://call.element.io",
clientID: "io.element.elementx")
clientID: "io.element.elementx",
useEncryption: false)
}()
static var previews: some View {