Handle wrong symbol error

This commit is contained in:
Pengwius 2021-02-20 22:20:53 +01:00
parent 6392f7220d
commit 9d5fa7d15e
5 changed files with 10 additions and 1 deletions

View file

@ -20,6 +20,7 @@ public extension Sdk {
case urlError
case wrongToken
case wrongSymbol
case wrongPin
}
}

View file

@ -224,10 +224,13 @@ public class Sdk {
let statusCode = status["Code"] as? Int else {
return nil
}
print("Response status code: \(statusCode)")
switch statusCode {
case 0: return nil
case 200: return APIError.wrongToken
case -1: return APIError.wrongSymbol //Ya, Vulcan returns -1 code
case 203: return APIError.wrongPin
default: return nil
}

View file

@ -42,6 +42,9 @@ struct ContentView: View {
switch("\(error)"){
case "wrongToken":
buttonValue = String(format: NSLocalizedString("\(error)", comment: "loginButton"))
case "wrongSymbol":
buttonValue = String(format: NSLocalizedString("\(error)", comment: "loginButton"))
case "wrongPin":
buttonValue = String(format: NSLocalizedString("\(error)", comment: "loginButton"))

View file

@ -12,6 +12,7 @@
"pin" = "Pin";
"loginButton" = "Login";
"wrongToken" = "Wrong token";
"wrongSymbol" = "Wrong symbol";
"wrongPin" = "Wrong pin";
"invalidData" = "Wrong token, symbol or pin";
"success" = "Success";

View file

@ -12,6 +12,7 @@
"pin" = "Pin";
"loginButton" = "Zaloguj";
"wrongToken" = "Zły token";
"wrongSymbol" = "Zły symbol";
"wrongPin" = "Zły pin";
"invalidData" = "Zły token, symbol lub pin";
"success" = "Sukces";