Key recovery: Show errors on invalid passphrase or recovery key

This commit is contained in:
manuroe
2019-02-14 13:14:00 +01:00
parent 1ab6506a39
commit d5f6cd932d
4 changed files with 47 additions and 2 deletions

View File

@@ -179,7 +179,19 @@ final class KeyBackupRecoverFromRecoveryKeyViewController: UIViewController {
private func render(error: Error) {
self.activityPresenter.removeCurrentActivityIndicator(animated: true)
self.errorPresenter.presentError(from: self, forError: error, animated: true, handler: nil)
if (error as NSError).domain == MXKeyBackupErrorDomain
&& (error as NSError).code == Int(MXKeyBackupErrorInvalidRecoveryKeyCode.rawValue) {
self.errorPresenter.presentError(from: self,
title: VectorL10n.keyBackupRecoverInvalidRecoveryKeyTitle,
message: VectorL10n.keyBackupRecoverInvalidRecoveryKey,
animated: true,
handler: nil)
}
else {
self.errorPresenter.presentError(from: self, forError: error, animated: true, handler: nil)
}
}
private func showFileSelection() {