Handle wrong symbol error
This commit is contained in:
parent
6392f7220d
commit
9d5fa7d15e
5 changed files with 10 additions and 1 deletions
|
@ -20,6 +20,7 @@ public extension Sdk {
|
|||
case urlError
|
||||
|
||||
case wrongToken
|
||||
case wrongSymbol
|
||||
case wrongPin
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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"))
|
||||
|
|
|
@ -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";
|
||||
|
|
|
@ -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";
|
||||
|
|
Loading…
Reference in a new issue