Secrets recovery: Handle MXRecoveryService errors in recovery view models.

This commit is contained in:
SBiOSoftWhare
2020-06-11 16:55:44 +02:00
parent 49211bdce2
commit 6dec25b2a3
3 changed files with 10 additions and 7 deletions
@@ -177,9 +177,12 @@ final class SecretsRecoveryWithKeyViewController: UIViewController {
private func render(error: Error) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
// TODO: Use appropriate error codes
if (error as NSError).domain == MXSecretStorageErrorDomain
&& (error as NSError).code == Int(MXSecretStorageErrorCode.badMacCode.rawValue) {
let nsError = error as NSError
if nsError.domain == MXRecoveryServiceErrorDomain
&& (nsError.code == Int(MXRecoveryServiceErrorCode.badRecoveryKeyErrorCode.rawValue)
|| nsError.code == Int(MXRecoveryServiceErrorCode.badRecoveryKeyFormatErrorCode.rawValue)
) {
self.errorPresenter.presentError(from: self,
title: VectorL10n.secretsRecoveryWithKeyInvalidRecoveryKeyTitle,