Implemented showing decoding error

This commit is contained in:
dankito 2020-07-26 17:40:52 +02:00
parent a470251be1
commit 89f1840655
3 changed files with 26 additions and 0 deletions

View File

@ -49,6 +49,8 @@
"TAN medium" = "TAN medium"; "TAN medium" = "TAN medium";
"TAN hint from your bank:" = "Hint from your bank:"; "TAN hint from your bank:" = "Hint from your bank:";
"Enter TAN:" = "TAN"; "Enter TAN:" = "TAN";
"Decoding error" = "Decoding error";
"Could not decode TAN challenge. Error: %@." = "Could not decode flicker code or QR code / PhotoTan. Most likely an internal error:\n%@.";
"TAN medium change" = "TAN medium change"; "TAN medium change" = "TAN medium change";
"TAN medium successfully changed to %@." = "TAN medium successfully changed to '%@'."; "TAN medium successfully changed to %@." = "TAN medium successfully changed to '%@'.";
"Could not change TAN medium to %@. Error: %@." = "Could not change TAN medium to '%@'.\n\nError message from your bank:\n\n%@."; "Could not change TAN medium to %@. Error: %@." = "Could not change TAN medium to '%@'.\n\nError message from your bank:\n\n%@.";

View File

@ -49,6 +49,8 @@
"TAN medium" = "TAN Medium"; "TAN medium" = "TAN Medium";
"TAN hint from your bank:" = "Hinweis Ihrer Bank:"; "TAN hint from your bank:" = "Hinweis Ihrer Bank:";
"Enter TAN:" = "TAN"; "Enter TAN:" = "TAN";
"Decoding error" = "Dekodierungsfehler";
"Could not decode TAN challenge. Error: %@." = "Flicker code oder QR code / PhotoTan konnten nicht dekodiert werden. Sehr wahrscheinlich ein interner Fehler:\n%@.";
"TAN medium change" = "TAN Medium Wechsel"; "TAN medium change" = "TAN Medium Wechsel";
"TAN medium successfully changed to %@." = "TAN Medium erfolgreich zu '%@' geändert."; "TAN medium successfully changed to %@." = "TAN Medium erfolgreich zu '%@' geändert.";
"Could not change TAN medium to %@. Error: %@." = "TAN medium konnte nicht zu '%@' geändert werden.\n\nFehlermeldung Ihrer Bank:\n\n%@."; "Could not change TAN medium to %@. Error: %@." = "TAN medium konnte nicht zu '%@' geändert werden.\n\nFehlermeldung Ihrer Bank:\n\n%@.";

View File

@ -77,6 +77,13 @@ struct EnterTanDialog: View {
self.showFlickerCodeTanView = tanChallenge is FlickerCodeTanChallenge self.showFlickerCodeTanView = tanChallenge is FlickerCodeTanChallenge
self.showImageTanView = tanChallenge is ImageTanChallenge self.showImageTanView = tanChallenge is ImageTanChallenge
if let decodingError = (tanChallenge as? FlickerCodeTanChallenge)?.flickerCode.decodingError {
showDecodingTanChallengeFailedErrorDelayed(decodingError)
}
if let decodingError = (tanChallenge as? ImageTanChallenge)?.image.decodingError {
showDecodingTanChallengeFailedErrorDelayed(decodingError)
}
} }
@ -177,6 +184,21 @@ struct EnterTanDialog: View {
} }
} }
/**
This method gets called right on start up before dialog is shown -> Alert would get displayed before dialog and therefore covered by dialog -> delay displaying alert.
*/
private func showDecodingTanChallengeFailedErrorDelayed(_ error: KotlinException?) {
DispatchQueue.main.asyncAfter(deadline: .now() + 1) {
self.showDecodingTanChallengeFailedError(error)
}
}
private func showDecodingTanChallengeFailedError(_ error: KotlinException?) {
if let errorMessage = error?.message {
self.errorMessage = Message(title: "Decoding error", message: "Could not decode TAN challenge. Error: \(errorMessage).", primaryButton: .ok())
}
}
private func enteringTanDone() { private func enteringTanDone() {
let companion = EnterTanResult.Companion() let companion = EnterTanResult.Companion()