mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 00:49:44 +00:00
Remove the CertificateValidatorHook. (#5624)
This commit is contained in:
@@ -1332,7 +1332,6 @@
|
|||||||
DF05F9C9D3D977EB77E13692 /* DeviceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 385D4C28F9DC5CF53BD9ECDB /* DeviceKit */; };
|
DF05F9C9D3D977EB77E13692 /* DeviceKit in Frameworks */ = {isa = PBXBuildFile; productRef = 385D4C28F9DC5CF53BD9ECDB /* DeviceKit */; };
|
||||||
DF40CDBEFE1D02B5F9C4ACB1 /* test_image.png in Resources */ = {isa = PBXBuildFile; fileRef = 810133CF215075C285FC6F3A /* test_image.png */; };
|
DF40CDBEFE1D02B5F9C4ACB1 /* test_image.png in Resources */ = {isa = PBXBuildFile; fileRef = 810133CF215075C285FC6F3A /* test_image.png */; };
|
||||||
DF504B10A4918F971A57BEF2 /* PostHogAnalyticsClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1715E3D7F53C0748AA50C91C /* PostHogAnalyticsClient.swift */; };
|
DF504B10A4918F971A57BEF2 /* PostHogAnalyticsClient.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1715E3D7F53C0748AA50C91C /* PostHogAnalyticsClient.swift */; };
|
||||||
DF8F1211F2B0B56F0FCCA5C2 /* CertificateValidatorHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3865AD7B7249C939D7C69C33 /* CertificateValidatorHook.swift */; };
|
|
||||||
DFF7D6A6C26DDD40D00AE579 /* target.yml in Resources */ = {isa = PBXBuildFile; fileRef = F012CB5EE3F2B67359F6CC52 /* target.yml */; };
|
DFF7D6A6C26DDD40D00AE579 /* target.yml in Resources */ = {isa = PBXBuildFile; fileRef = F012CB5EE3F2B67359F6CC52 /* target.yml */; };
|
||||||
E010DDE938032D3B8E84CC35 /* TracingHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A95C9B8299A36A6495DECA6 /* TracingHook.swift */; };
|
E010DDE938032D3B8E84CC35 /* TracingHook.swift in Sources */ = {isa = PBXBuildFile; fileRef = 2A95C9B8299A36A6495DECA6 /* TracingHook.swift */; };
|
||||||
E02DAD9FD8D62587049FFFEC /* LinkNewDeviceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F04B12FA231E797B7151A8 /* LinkNewDeviceTests.swift */; };
|
E02DAD9FD8D62587049FFFEC /* LinkNewDeviceTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 80F04B12FA231E797B7151A8 /* LinkNewDeviceTests.swift */; };
|
||||||
@@ -1962,7 +1961,6 @@
|
|||||||
38345442415E07A931197C55 /* AppLockScreenPINKeypad.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockScreenPINKeypad.swift; sourceTree = "<group>"; };
|
38345442415E07A931197C55 /* AppLockScreenPINKeypad.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AppLockScreenPINKeypad.swift; sourceTree = "<group>"; };
|
||||||
38354164AF59C5006CD05878 /* GlobalSearchScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenViewModel.swift; sourceTree = "<group>"; };
|
38354164AF59C5006CD05878 /* GlobalSearchScreenViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = GlobalSearchScreenViewModel.swift; sourceTree = "<group>"; };
|
||||||
384A744714571BAF138C6B86 /* ClassicAppAES.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassicAppAES.swift; sourceTree = "<group>"; };
|
384A744714571BAF138C6B86 /* ClassicAppAES.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ClassicAppAES.swift; sourceTree = "<group>"; };
|
||||||
3865AD7B7249C939D7C69C33 /* CertificateValidatorHook.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CertificateValidatorHook.swift; sourceTree = "<group>"; };
|
|
||||||
38E521D6C2BF8DF0DFB35146 /* DeveloperOptionsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperOptionsScreen.swift; sourceTree = "<group>"; };
|
38E521D6C2BF8DF0DFB35146 /* DeveloperOptionsScreen.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeveloperOptionsScreen.swift; sourceTree = "<group>"; };
|
||||||
3984C93B8E9B10C92DADF9EE /* RoomDirectorySearchScreenScreenModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchScreenScreenModelProtocol.swift; sourceTree = "<group>"; };
|
3984C93B8E9B10C92DADF9EE /* RoomDirectorySearchScreenScreenModelProtocol.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RoomDirectorySearchScreenScreenModelProtocol.swift; sourceTree = "<group>"; };
|
||||||
398817652FA8ABAE0A31AC6D /* ReadableFrameModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadableFrameModifier.swift; sourceTree = "<group>"; };
|
398817652FA8ABAE0A31AC6D /* ReadableFrameModifier.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ReadableFrameModifier.swift; sourceTree = "<group>"; };
|
||||||
@@ -3738,7 +3736,6 @@
|
|||||||
children = (
|
children = (
|
||||||
13BE9781699FB510E9263192 /* AppSettingsHook.swift */,
|
13BE9781699FB510E9263192 /* AppSettingsHook.swift */,
|
||||||
25586C0ADB814FEE9897DCAA /* BugReportHook.swift */,
|
25586C0ADB814FEE9897DCAA /* BugReportHook.swift */,
|
||||||
3865AD7B7249C939D7C69C33 /* CertificateValidatorHook.swift */,
|
|
||||||
7AC0CD1CAFD3F8B057F9AEA5 /* ClientBuilderHook.swift */,
|
7AC0CD1CAFD3F8B057F9AEA5 /* ClientBuilderHook.swift */,
|
||||||
8B89D6C760E8CAE29CA28FB1 /* CompoundHook.swift */,
|
8B89D6C760E8CAE29CA28FB1 /* CompoundHook.swift */,
|
||||||
0F60FDB3AEFC60830BD289FE /* DeveloperOptionsScreenHook.swift */,
|
0F60FDB3AEFC60830BD289FE /* DeveloperOptionsScreenHook.swift */,
|
||||||
@@ -8273,7 +8270,6 @@
|
|||||||
84CAE3E96D93194DA06B9194 /* CallScreenViewModelProtocol.swift in Sources */,
|
84CAE3E96D93194DA06B9194 /* CallScreenViewModelProtocol.swift in Sources */,
|
||||||
BB6BF528BC7F5B87E08C4F18 /* CameraPicker.swift in Sources */,
|
BB6BF528BC7F5B87E08C4F18 /* CameraPicker.swift in Sources */,
|
||||||
E14E469CD97550D0FC58F3CA /* CancellableTask.swift in Sources */,
|
E14E469CD97550D0FC58F3CA /* CancellableTask.swift in Sources */,
|
||||||
DF8F1211F2B0B56F0FCCA5C2 /* CertificateValidatorHook.swift in Sources */,
|
|
||||||
D885B783B95AD7832D4EF5DD /* CharacterSet.swift in Sources */,
|
D885B783B95AD7832D4EF5DD /* CharacterSet.swift in Sources */,
|
||||||
3E2EE5782688054B3026EF8E /* ChatsSpaceFilterCell.swift in Sources */,
|
3E2EE5782688054B3026EF8E /* ChatsSpaceFilterCell.swift in Sources */,
|
||||||
E713F930C5AD0F4B11119E2B /* ChatsSpaceFiltersScreen.swift in Sources */,
|
E713F930C5AD0F4B11119E2B /* ChatsSpaceFiltersScreen.swift in Sources */,
|
||||||
|
|||||||
@@ -42,15 +42,6 @@ final class AppHooks: AppHooksProtocol {
|
|||||||
_bugReportHook.withLock { $0 = hook }
|
_bugReportHook.withLock { $0 = hook }
|
||||||
}
|
}
|
||||||
|
|
||||||
private let _certificateValidatorHook: Mutex<CertificateValidatorHookProtocol> = Mutex(DefaultCertificateValidator())
|
|
||||||
var certificateValidatorHook: CertificateValidatorHookProtocol {
|
|
||||||
_certificateValidatorHook.withLock { $0 }
|
|
||||||
}
|
|
||||||
|
|
||||||
func registerCertificateValidatorHook(_ hook: CertificateValidatorHookProtocol) {
|
|
||||||
_certificateValidatorHook.withLock { $0 = hook }
|
|
||||||
}
|
|
||||||
|
|
||||||
private let _oAuthPresenterHook: Mutex<OAuthPresenterHookProtocol> = Mutex(DefaultOAuthPresenterHook())
|
private let _oAuthPresenterHook: Mutex<OAuthPresenterHookProtocol> = Mutex(DefaultOAuthPresenterHook())
|
||||||
var oAuthPresenterHook: OAuthPresenterHookProtocol {
|
var oAuthPresenterHook: OAuthPresenterHookProtocol {
|
||||||
_oAuthPresenterHook.withLock { $0 }
|
_oAuthPresenterHook.withLock { $0 }
|
||||||
|
|||||||
@@ -1,19 +0,0 @@
|
|||||||
//
|
|
||||||
// Copyright 2025 Element Creations Ltd.
|
|
||||||
// Copyright 2024-2025 New Vector Ltd.
|
|
||||||
//
|
|
||||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
|
||||||
// Please see LICENSE files in the repository root for full details.
|
|
||||||
//
|
|
||||||
|
|
||||||
import Foundation
|
|
||||||
|
|
||||||
protocol CertificateValidatorHookProtocol {
|
|
||||||
func respondTo(_ challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?)
|
|
||||||
}
|
|
||||||
|
|
||||||
struct DefaultCertificateValidator: CertificateValidatorHookProtocol {
|
|
||||||
func respondTo(_ challenge: URLAuthenticationChallenge) async -> (URLSession.AuthChallengeDisposition, URLCredential?) {
|
|
||||||
(.performDefaultHandling, nil)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -433,7 +433,6 @@ class UserSessionFlowCoordinator: FlowCoordinatorProtocol {
|
|||||||
configuration: configuration,
|
configuration: configuration,
|
||||||
allowPictureInPicture: true,
|
allowPictureInPicture: true,
|
||||||
appSettings: flowParameters.appSettings,
|
appSettings: flowParameters.appSettings,
|
||||||
appHooks: flowParameters.appHooks,
|
|
||||||
analytics: flowParameters.analytics))
|
analytics: flowParameters.analytics))
|
||||||
|
|
||||||
callScreenCoordinator.actions
|
callScreenCoordinator.actions
|
||||||
|
|||||||
@@ -15,7 +15,6 @@ struct CallScreenCoordinatorParameters {
|
|||||||
let configuration: ElementCallConfiguration
|
let configuration: ElementCallConfiguration
|
||||||
let allowPictureInPicture: Bool
|
let allowPictureInPicture: Bool
|
||||||
let appSettings: AppSettings
|
let appSettings: AppSettings
|
||||||
let appHooks: AppHooks
|
|
||||||
let analytics: AnalyticsServiceProtocol
|
let analytics: AnalyticsServiceProtocol
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,7 +45,6 @@ final class CallScreenCoordinator: CoordinatorProtocol {
|
|||||||
viewModel = CallScreenViewModel(elementCallService: parameters.elementCallService,
|
viewModel = CallScreenViewModel(elementCallService: parameters.elementCallService,
|
||||||
configuration: parameters.configuration,
|
configuration: parameters.configuration,
|
||||||
allowPictureInPicture: parameters.allowPictureInPicture,
|
allowPictureInPicture: parameters.allowPictureInPicture,
|
||||||
appHooks: parameters.appHooks,
|
|
||||||
appSettings: parameters.appSettings,
|
appSettings: parameters.appSettings,
|
||||||
analyticsService: parameters.analytics)
|
analyticsService: parameters.analytics)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -20,8 +20,6 @@ struct CallScreenViewState: BindableState {
|
|||||||
let script: String?
|
let script: String?
|
||||||
var url: URL?
|
var url: URL?
|
||||||
|
|
||||||
let certificateValidator: CertificateValidatorHookProtocol
|
|
||||||
|
|
||||||
var bindings = Bindings()
|
var bindings = Bindings()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,6 @@ class CallScreenViewModel: CallScreenViewModelType, CallScreenViewModelProtocol
|
|||||||
init(elementCallService: ElementCallServiceProtocol,
|
init(elementCallService: ElementCallServiceProtocol,
|
||||||
configuration: ElementCallConfiguration,
|
configuration: ElementCallConfiguration,
|
||||||
allowPictureInPicture: Bool,
|
allowPictureInPicture: Bool,
|
||||||
appHooks: AppHooks,
|
|
||||||
appSettings: AppSettings,
|
appSettings: AppSettings,
|
||||||
analyticsService: AnalyticsServiceProtocol) {
|
analyticsService: AnalyticsServiceProtocol) {
|
||||||
self.elementCallService = elementCallService
|
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.") }
|
guard let deviceID = configuration.clientProxy.deviceID else { fatalError("Missing device ID for the call.") }
|
||||||
widgetDriver = configuration.roomProxy.elementCallWidgetDriver(deviceID: deviceID)
|
widgetDriver = configuration.roomProxy.elementCallWidgetDriver(deviceID: deviceID)
|
||||||
|
|
||||||
super.init(initialViewState: CallScreenViewState(script: CallScreenJavaScriptMessageName.allCasesInjectionScript,
|
super.init(initialViewState: CallScreenViewState(script: CallScreenJavaScriptMessageName.allCasesInjectionScript))
|
||||||
certificateValidator: appHooks.certificateValidatorHook))
|
|
||||||
|
|
||||||
elementCallService.actions
|
elementCallService.actions
|
||||||
.receive(on: DispatchQueue.main)
|
.receive(on: DispatchQueue.main)
|
||||||
|
|||||||
@@ -74,7 +74,6 @@ private struct CallView: UIViewRepresentable {
|
|||||||
@MainActor
|
@MainActor
|
||||||
class Coordinator: NSObject, WKUIDelegate, WKNavigationDelegate, AVPictureInPictureControllerDelegate {
|
class Coordinator: NSObject, WKUIDelegate, WKNavigationDelegate, AVPictureInPictureControllerDelegate {
|
||||||
private weak var viewModelContext: CallScreenViewModel.Context?
|
private weak var viewModelContext: CallScreenViewModel.Context?
|
||||||
private let certificateValidator: CertificateValidatorHookProtocol
|
|
||||||
|
|
||||||
private var webView: WKWebView!
|
private var webView: WKWebView!
|
||||||
private var pictureInPictureController: AVPictureInPictureController?
|
private var pictureInPictureController: AVPictureInPictureController?
|
||||||
@@ -88,7 +87,6 @@ private struct CallView: UIViewRepresentable {
|
|||||||
|
|
||||||
init(viewModelContext: CallScreenViewModel.Context) {
|
init(viewModelContext: CallScreenViewModel.Context) {
|
||||||
self.viewModelContext = viewModelContext
|
self.viewModelContext = viewModelContext
|
||||||
certificateValidator = viewModelContext.viewState.certificateValidator
|
|
||||||
pictureInPictureViewController = AVPictureInPictureVideoCallViewController()
|
pictureInPictureViewController = AVPictureInPictureVideoCallViewController()
|
||||||
pictureInPictureViewController.preferredContentSize = CGSize(width: 1920, height: 1080)
|
pictureInPictureViewController.preferredContentSize = CGSize(width: 1920, height: 1080)
|
||||||
|
|
||||||
@@ -238,10 +236,6 @@ private struct CallView: UIViewRepresentable {
|
|||||||
|
|
||||||
// MARK: - WKNavigationDelegate
|
// 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 {
|
func webView(_ webView: WKWebView, decidePolicyFor navigationAction: WKNavigationAction) async -> WKNavigationActionPolicy {
|
||||||
if let navigationURL = navigationAction.request.url {
|
if let navigationURL = navigationAction.request.url {
|
||||||
// Do not allow navigation to a different URL scheme.
|
// Do not allow navigation to a different URL scheme.
|
||||||
@@ -351,7 +345,13 @@ private struct CallView: UIViewRepresentable {
|
|||||||
// MARK: - Previews
|
// MARK: - Previews
|
||||||
|
|
||||||
struct CallScreen_Previews: PreviewProvider {
|
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()
|
let clientProxy = ClientProxyMock()
|
||||||
clientProxy.deviceID = "call-device-id"
|
clientProxy.deviceID = "call-device-id"
|
||||||
|
|
||||||
@@ -373,12 +373,7 @@ struct CallScreen_Previews: PreviewProvider {
|
|||||||
voiceOnly: false,
|
voiceOnly: false,
|
||||||
colorScheme: .light),
|
colorScheme: .light),
|
||||||
allowPictureInPicture: false,
|
allowPictureInPicture: false,
|
||||||
appHooks: AppHooks(),
|
|
||||||
appSettings: .volatile(),
|
appSettings: .volatile(),
|
||||||
analyticsService: AnalyticsServiceMock.default)
|
analyticsService: AnalyticsServiceMock.default)
|
||||||
}()
|
|
||||||
|
|
||||||
static var previews: some View {
|
|
||||||
CallScreen(context: viewModel.context)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-1
Submodule Enterprise updated: 0157e82576...a8ea823ff9
Reference in New Issue
Block a user