Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix a bug where UIA for cross signing wasn't needed until after checking for it. #7874

Merged
merged 3 commits into from
Nov 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 6 additions & 6 deletions Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,16 @@ PODS:
- LoggerAPI (1.9.200):
- Logging (~> 1.1)
- Logging (1.4.0)
- MatrixSDK (0.27.15):
- MatrixSDK/Core (= 0.27.15)
- MatrixSDK/Core (0.27.15):
- MatrixSDK (0.27.16):
- MatrixSDK/Core (= 0.27.16)
- MatrixSDK/Core (0.27.16):
- AFNetworking (~> 4.0.0)
- GZIP (~> 1.3.0)
- libbase58 (~> 0.1.4)
- MatrixSDKCrypto (= 0.4.3)
- Realm (= 10.27.0)
- SwiftyBeaver (= 1.9.5)
- MatrixSDK/JingleCallStack (0.27.15):
- MatrixSDK/JingleCallStack (0.27.16):
- JitsiMeetSDKLite (= 8.1.2-lite)
- MatrixSDK/Core
- MatrixSDKCrypto (0.4.3)
Expand Down Expand Up @@ -179,7 +179,7 @@ SPEC CHECKSUMS:
libPhoneNumber-iOS: 0a32a9525cf8744fe02c5206eb30d571e38f7d75
LoggerAPI: ad9c4a6f1e32f518fdb43a1347ac14d765ab5e3d
Logging: beeb016c9c80cf77042d62e83495816847ef108b
MatrixSDK: 12b379749b84ab5b3662042acb1914b9f9bb692b
MatrixSDK: ce8f2cec670c2212144a129cc617d4144c89b97f
MatrixSDKCrypto: 27bee960e0e8b3a3039f3f3e93dd2ec88299c77e
ReadMoreTextView: 19147adf93abce6d7271e14031a00303fe28720d
Realm: 9ca328bd7e700cc19703799785e37f77d1a130f2
Expand All @@ -198,6 +198,6 @@ SPEC CHECKSUMS:
zxcvbn-ios: fef98b7c80f1512ff0eec47ac1fa399fc00f7e3c
ZXingObjC: 8898711ab495761b2dbbdec76d90164a6d7e14c5

PODFILE CHECKSUM: 484a1cdf04951cc82156f29de196efd76d3ad893
PODFILE CHECKSUM: 9148246fffa2c32e3c9b29a51cae4bb037497056

COCOAPODS: 1.14.3
43 changes: 21 additions & 22 deletions Riot/Modules/CrossSigning/Setup/CrossSigningSetupCoordinator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -45,49 +45,48 @@ final class CrossSigningSetupCoordinator: CrossSigningSetupCoordinatorType {
// MARK: - Public methods

func start() {
self.showReauthentication()
setupCrossSigning()
}

func toPresentable() -> UIViewController {
return self.parameters.presenter.toPresentable()
}

// MARK: - Private methods

private func showReauthentication() {

private func setupCrossSigning(with authenticationParameters: [String: Any] = [:]) {
guard let crossSigning = parameters.session.crypto?.crossSigning else { return }

crossSigning.setup(withAuthParams: authenticationParameters) { [weak self] in
guard let self else { return }
delegate?.crossSigningSetupCoordinatorDidComplete(self)
} failure: { [weak self] error in
guard let self else { return }

if let responseData = (error as NSError).userInfo[MXHTTPClientErrorResponseDataKey] as? [AnyHashable: Any],
let authenticationSession = MXAuthenticationSession(fromJSON: responseData) {
showReauthentication(authenticationSession: authenticationSession)
} else {
delegate?.crossSigningSetupCoordinator(self, didFailWithError: error)
}
}
}

private func showReauthentication(authenticationSession: MXAuthenticationSession) {
let setupCrossSigningRequest = self.crossSigningService.setupCrossSigningRequest()

let reauthenticationParameters = ReauthenticationCoordinatorParameters(session: parameters.session,
presenter: parameters.presenter,
title: parameters.title,
message: parameters.message,
authenticatedEndpointRequest: setupCrossSigningRequest)
authenticationSession: authenticationSession)

let coordinator = ReauthenticationCoordinator(parameters: reauthenticationParameters)
coordinator.delegate = self
self.add(childCoordinator: coordinator)

coordinator.start()
}

private func setupCrossSigning(with authenticationParameters: [String: Any]) {
guard let crossSigning = self.parameters.session.crypto?.crossSigning else {
return
}

crossSigning.setup(withAuthParams: authenticationParameters) { [weak self] in
guard let self = self else {
return
}
self.delegate?.crossSigningSetupCoordinatorDidComplete(self)
} failure: { [weak self] error in
guard let self = self else {
return
}
self.delegate?.crossSigningSetupCoordinator(self, didFailWithError: error)
}
}
}

// MARK: - ReauthenticationCoordinatorDelegate
Expand Down
Loading