mirror of
https://gitlab.opencode.de/bwi/bundesmessenger/clients/bundesmessenger-ios.git
synced 2026-04-16 06:28:27 +02:00
fix: Fix Passphrase reset for new synapse behaviour (MESSENGER-7295)
This commit is contained in:
@@ -68,6 +68,7 @@ final class CrossSigningService: NSObject {
|
||||
}
|
||||
|
||||
func setupCrossSigningRequest() -> AuthenticatedEndpointRequest {
|
||||
// bwi 7295 could be fixed here to by adding a fake master key to the request
|
||||
let path = "\(kMXAPIPrefixPathUnstable)/keys/device_signing/upload"
|
||||
return AuthenticatedEndpointRequest(path: path, httpMethod: "POST", params: [:])
|
||||
}
|
||||
|
||||
@@ -72,6 +72,23 @@ final class SecretsResetCoordinator: SecretsResetCoordinatorType {
|
||||
coordinator.start()
|
||||
self.add(childCoordinator: coordinator)
|
||||
}
|
||||
|
||||
|
||||
// bwi 7295 need to do authentication with session on an 401 error
|
||||
private func showAuthentication(with session: MXAuthenticationSession) {
|
||||
let reauthenticationCoordinatorParameters = ReauthenticationCoordinatorParameters(session: self.session,
|
||||
presenter: self.toPresentable(),
|
||||
title: nil,
|
||||
message: BWIL10n.secretsResetAuthenticationMessage,
|
||||
authenticationSession: session)
|
||||
|
||||
let coordinator = ReauthenticationCoordinator(parameters: reauthenticationCoordinatorParameters)
|
||||
coordinator.delegate = self
|
||||
coordinator.start()
|
||||
self.add(childCoordinator: coordinator)
|
||||
}
|
||||
// bwi 7295 end
|
||||
|
||||
}
|
||||
|
||||
// MARK: - SecretsResetViewModelCoordinatorDelegate
|
||||
@@ -81,6 +98,12 @@ extension SecretsResetCoordinator: SecretsResetViewModelCoordinatorDelegate {
|
||||
self.showAuthentication(with: request)
|
||||
}
|
||||
|
||||
// bwi 7295 need to do authentication with session on an 401 error
|
||||
func secretsResetViewModel(_ viewModel: SecretsResetViewModelType, needsToAuthenticateWith session: MXAuthenticationSession) {
|
||||
self.showAuthentication(with: session)
|
||||
}
|
||||
// bwi 7295 end
|
||||
|
||||
func secretsResetViewModelDidResetSecrets(_ viewModel: SecretsResetViewModelType) {
|
||||
self.delegate?.secretsResetCoordinatorDidResetSecrets(self)
|
||||
}
|
||||
|
||||
@@ -92,7 +92,18 @@ final class SecretsResetViewModel: SecretsResetViewModelType {
|
||||
guard let self = self else {
|
||||
return
|
||||
}
|
||||
self.update(viewState: .error(error))
|
||||
|
||||
// bwi 7295 need to do authentication with session on an 401 error
|
||||
let nsError = error as NSError
|
||||
|
||||
if let matrixData = nsError.userInfo["com.matrixsdk.httpclient.error.response.data"] as? [String: Any],
|
||||
let session = MXAuthenticationSession(fromJSON: matrixData) {
|
||||
self.coordinatorDelegate?.secretsResetViewModel(self, needsToAuthenticateWith: session)
|
||||
} else {
|
||||
self.update(viewState: .error(error))
|
||||
}
|
||||
// bwi 7295 end
|
||||
|
||||
})
|
||||
}
|
||||
|
||||
|
||||
@@ -24,6 +24,8 @@ protocol SecretsResetViewModelViewDelegate: AnyObject {
|
||||
|
||||
protocol SecretsResetViewModelCoordinatorDelegate: AnyObject {
|
||||
func secretsResetViewModel(_ viewModel: SecretsResetViewModelType, needsToAuthenticateWith request: AuthenticatedEndpointRequest)
|
||||
// bwi 7295 need to do authentication with session
|
||||
func secretsResetViewModel(_ viewModel: SecretsResetViewModelType, needsToAuthenticateWith session: MXAuthenticationSession)
|
||||
func secretsResetViewModelDidResetSecrets(_ viewModel: SecretsResetViewModelType)
|
||||
func secretsResetViewModelDidCancel(_ viewModel: SecretsResetViewModelType)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user