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
@@ -181,7 +181,19 @@ final class KeyBackupRecoverFromPassphraseViewController: 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.keyBackupRecoverInvalidPassphraseTitle,
message: VectorL10n.keyBackupRecoverInvalidPassphrase,
animated: true,
handler: nil)
}
else {
self.errorPresenter.presentError(from: self, forError: error, animated: true, handler: nil)
}
}
// MARK: - Actions