fix toast error message for scanning recovery password qrcode

pull/891/head
Ryan ZHAO 11 months ago
parent c342deb94e
commit 2301c75c08

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1100,6 +1100,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1100,6 +1100,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1105,6 +1105,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -1099,6 +1099,7 @@ The point that a message will disappear in a disappearing message update message
"qrView" = "View QR";
"recoveryPasswordView" = "View Password";
"yes" = "Yes";
"qrNotRecoveryPassword" = "This QR code does not contain a Recovery Password";
//Settings
"view" = "View";

@ -50,9 +50,9 @@ struct LoadAccountScreen: View {
}
}
private func continueWithSeed(seed: Data, onError: (() -> ())?) {
private func continueWithSeed(seed: Data, from source: Onboarding.SeedSource, onError: (() -> ())?) {
if (seed.count != 16) {
errorString = "recoveryPasswordErrorMessageGeneric".localized()
errorString = source.genericErrorMessage
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
onError?()
}
@ -75,7 +75,7 @@ struct LoadAccountScreen: View {
func continueWithhexEncodedSeed(onError: (() -> ())?) {
let seed = Data(hex: hexEncodedSeed)
continueWithSeed(seed: seed, onError: onError)
continueWithSeed(seed: seed, from: .qrCode, onError: onError)
}
func continueWithMnemonic() {
@ -85,21 +85,14 @@ struct LoadAccountScreen: View {
hexEncodedSeed = try Mnemonic.decode(mnemonic: mnemonic)
} catch {
if let decodingError = error as? Mnemonic.DecodingError {
switch decodingError {
case .inputTooShort:
errorString = "recoveryPasswordErrorMessageShort".localized()
case .invalidWord:
errorString = "recoveryPasswordErrorMessageIncorrect".localized()
default:
errorString = "recoveryPasswordErrorMessageGeneric".localized()
}
errorString = decodingError.errorDescription
} else {
errorString = "recoveryPasswordErrorMessageGeneric".localized()
}
return
}
let seed = Data(hex: hexEncodedSeed)
continueWithSeed(seed: seed, onError: nil)
continueWithSeed(seed: seed, from: .mnemonic, onError: nil)
}
}

@ -58,6 +58,20 @@ enum Onboarding {
.eraseToAnyPublisher()
}
enum SeedSource {
case qrCode
case mnemonic
var genericErrorMessage: String {
switch self {
case .qrCode:
"qrNotRecoveryPassword".localized()
case .mnemonic:
"recoveryPasswordErrorMessageGeneric".localized()
}
}
}
enum State: CustomStringConvertible {
case newUser
case missingName

@ -68,13 +68,14 @@ public enum Mnemonic {
public enum DecodingError : LocalizedError {
case generic, inputTooShort, missingLastWord, invalidWord, verificationFailed
public var errorDescription: String? {
public var errorDescription: String {
switch self {
case .generic: return "RECOVERY_PHASE_ERROR_GENERIC".localized()
case .inputTooShort: return "RECOVERY_PHASE_ERROR_LENGTH".localized()
case .missingLastWord: return "RECOVERY_PHASE_ERROR_LAST_WORD".localized()
case .invalidWord: return "RECOVERY_PHASE_ERROR_INVALID_WORD".localized()
case .verificationFailed: return "RECOVERY_PHASE_ERROR_FAILED".localized()
case .inputTooShort:
return "recoveryPasswordErrorMessageShort".localized()
case .invalidWord:
return "recoveryPasswordErrorMessageIncorrect".localized()
default:
return "recoveryPasswordErrorMessageGeneric".localized()
}
}
}

Loading…
Cancel
Save