mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Update the SDK and Element Call. (#4522)
* Update the SDK and Element Call. Additionally fix a bug where there was no way to navigate out of a call link after hanging up. * Remove the temporary parameters.
This commit is contained in:
@@ -18,6 +18,7 @@ enum CallScreenViewModelAction {
|
||||
struct CallScreenViewState: BindableState {
|
||||
let script: String?
|
||||
var url: URL?
|
||||
let isGenericCallLink: Bool
|
||||
|
||||
let certificateValidator: CertificateValidatorHookProtocol
|
||||
|
||||
|
||||
@@ -47,15 +47,18 @@ 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)
|
||||
}
|
||||
|
||||
super.init(initialViewState: CallScreenViewState(script: CallScreenJavaScriptMessageName.allCasesInjectionScript,
|
||||
isGenericCallLink: isGenericCallLink,
|
||||
certificateValidator: appHooks.certificateValidatorHook))
|
||||
|
||||
elementCallService.actions
|
||||
|
||||
@@ -16,10 +16,16 @@ struct CallScreen: View {
|
||||
@ObservedObject var context: CallScreenViewModel.Context
|
||||
|
||||
var body: some View {
|
||||
content
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.alert(item: $context.alertInfo)
|
||||
NavigationStack {
|
||||
content
|
||||
.frame(maxWidth: .infinity, maxHeight: .infinity)
|
||||
.background(Color.compound.bgCanvasDefault.ignoresSafeArea())
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.toolbar(context.viewState.isGenericCallLink ? .visible : .hidden, for: .navigationBar)
|
||||
.toolbar { toolbar }
|
||||
}
|
||||
.alert(item: $context.alertInfo)
|
||||
.preferredColorScheme(context.viewState.isGenericCallLink ? .dark : nil)
|
||||
}
|
||||
|
||||
@ViewBuilder
|
||||
@@ -33,6 +39,15 @@ struct CallScreen: View {
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
}
|
||||
}
|
||||
|
||||
var toolbar: some ToolbarContent {
|
||||
ToolbarItem(placement: .cancellationAction) {
|
||||
Button { context.send(viewAction: .navigateBack) } label: {
|
||||
Image(systemSymbol: .chevronBackward)
|
||||
.fontWeight(.semibold)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private struct CallView: UIViewRepresentable {
|
||||
|
||||
Reference in New Issue
Block a user