Remove the CertificateValidatorHook. (#5624)

This commit is contained in:
Doug
2026-05-22 15:26:54 +01:00
committed by GitHub
parent 77c5aba326
commit 86b51fb104
9 changed files with 9 additions and 53 deletions
@@ -15,7 +15,6 @@ struct CallScreenCoordinatorParameters {
let configuration: ElementCallConfiguration
let allowPictureInPicture: Bool
let appSettings: AppSettings
let appHooks: AppHooks
let analytics: AnalyticsServiceProtocol
}
@@ -46,7 +45,6 @@ final class CallScreenCoordinator: CoordinatorProtocol {
viewModel = CallScreenViewModel(elementCallService: parameters.elementCallService,
configuration: parameters.configuration,
allowPictureInPicture: parameters.allowPictureInPicture,
appHooks: parameters.appHooks,
appSettings: parameters.appSettings,
analyticsService: parameters.analytics)
}
@@ -20,8 +20,6 @@ struct CallScreenViewState: BindableState {
let script: String?
var url: URL?
let certificateValidator: CertificateValidatorHookProtocol
var bindings = Bindings()
}
@@ -39,7 +39,6 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
init(elementCallService: ElementCallServiceProtocol,
configuration: ElementCallConfiguration,
allowPictureInPicture: Bool,
appHooks: AppHooks,
appSettings: AppSettings,
analyticsService: AnalyticsServiceProtocol) {
self.elementCallService = elementCallService
@@ -51,8 +50,7 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
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,
certificateValidator: appHooks.certificateValidatorHook))
super.init(initialViewState: CallScreenViewState(script: CallScreenJavaScriptMessageName.allCasesInjectionScript))
elementCallService.actions
.receive(on: DispatchQueue.main)
@@ -74,7 +74,6 @@ private struct CallView: UIViewRepresentable {
@MainActor
class Coordinator: NSObject, WKUIDelegate, WKNavigationDelegate, AVPictureInPictureControllerDelegate {
private weak var viewModelContext: CallScreenViewModel.Context?
private let certificateValidator: CertificateValidatorHookProtocol
private var webView: WKWebView!
private var pictureInPictureController: AVPictureInPictureController?
@@ -88,7 +87,6 @@ private struct CallView: UIViewRepresentable {
init(viewModelContext: CallScreenViewModel.Context) {
self.viewModelContext = viewModelContext
certificateValidator = viewModelContext.viewState.certificateValidator
pictureInPictureViewController = AVPictureInPictureVideoCallViewController()
pictureInPictureViewController.preferredContentSize = CGSize(width: 1920, height: 1080)
@@ -238,10 +236,6 @@ private struct CallView: UIViewRepresentable {
// MARK: - WKNavigationDelegate
func webView(_ webView: WKWebView, respondTo challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) {
await certificateValidator.respondTo(challenge)
}
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
if let navigationURL = navigationAction.request.url {
// Do not allow navigation to a different URL scheme.
@@ -351,7 +345,13 @@ private struct CallView: UIViewRepresentable {
// MARK: - Previews
struct CallScreen_Previews: PreviewProvider {
static let viewModel = {
static let viewModel = makeViewModel()
static var previews: some View {
CallScreen(context: viewModel.context)
}
static func makeViewModel() -> CallScreenViewModel {
let clientProxy = ClientProxyMock()
clientProxy.deviceID = "call-device-id"
@@ -373,12 +373,7 @@ struct CallScreen_Previews: PreviewProvider {
voiceOnly: false,
colorScheme: .light),
allowPictureInPicture: false,
appHooks: AppHooks(),
appSettings: .volatile(),
analyticsService: AnalyticsServiceMock.default)
}()
static var previews: some View {
CallScreen(context: viewModel.context)
}
}