From 339fa0a378e2b4a0a7fdc128b7b2f69f5b6dbd44 Mon Sep 17 00:00:00 2001 From: stargateprovider Date: Mon, 8 Nov 2021 23:51:07 +0200 Subject: [PATCH] Added basic notifications to the user For when exceptions occur when communicating with the ID-card --- .../mobileauthapp/auth/AuthAppException.kt | 10 ++++++++++ .../mobileauthapp/auth/InvalidCANException.kt | 7 +++++++ MobileAuthApp/app/src/main/res/values-en/strings.xml | 7 ++++++- MobileAuthApp/app/src/main/res/values-et/strings.xml | 7 ++++++- MobileAuthApp/app/src/main/res/values/strings.xml | 7 ++++++- 5 files changed, 35 insertions(+), 3 deletions(-) create mode 100644 MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt create mode 100644 MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt new file mode 100644 index 0000000..96b05d5 --- /dev/null +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/AuthAppException.kt @@ -0,0 +1,10 @@ +package com.tarkvaraprojekt.mobileauthapp.auth + +/** + * A specialised RuntimeException class for exceptions related to the mobile authentication app. + * Possible error codes can be found at + * https://github.com/TanelOrumaa/Estonian-ID-card-mobile-authenticator-POC/wiki/Error-codes + * @param message Error message + * @param code An error code defined in the project wiki + */ +open class AuthAppException(message: String, var code: Int) : RuntimeException(message) \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt new file mode 100644 index 0000000..073c790 --- /dev/null +++ b/MobileAuthApp/app/src/main/java/com/tarkvaraprojekt/mobileauthapp/auth/InvalidCANException.kt @@ -0,0 +1,7 @@ +package com.tarkvaraprojekt.mobileauthapp.auth + +/** + * An AuthAppException for when the user entered CAN does not match the one read from the ID-card + * @see AuthAppException + */ +class InvalidCANException : AuthAppException("Invalid CAN", 400) \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/values-en/strings.xml b/MobileAuthApp/app/src/main/res/values-en/strings.xml index 36dce82..69af501 100644 --- a/MobileAuthApp/app/src/main/res/values-en/strings.xml +++ b/MobileAuthApp/app/src/main/res/values-en/strings.xml @@ -44,7 +44,9 @@ Put the ID card against the phone to establish connection Time left %d sek No time left - Wrong CAN + Unknown error + Wrong CAN + Connection between device and ID-card lost NAME @@ -75,4 +77,7 @@ **** Settings currently unavailabe CAN is currently not saved. Do you wish to save the CAN? Saved CAN will be entered automatically in the future. Saved CAN can be changed and deleted in the settings menu. + Failed to read data from the ID-card + Internal error + Read bad data from the ID-card, try using the card again \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/values-et/strings.xml b/MobileAuthApp/app/src/main/res/values-et/strings.xml index 63c0eae..1dedbd0 100644 --- a/MobileAuthApp/app/src/main/res/values-et/strings.xml +++ b/MobileAuthApp/app/src/main/res/values-et/strings.xml @@ -43,7 +43,9 @@ ID kaardiga ühenduse loomiseks pane kaart vastu telefoni Aega on jäänud %d sek Aeg on otsas - Vale CAN + Tundmatu viga + Vale CAN + Ühendus seadme ja kaardi vahel katkes NIMI @@ -73,4 +75,7 @@ PEIDA **** Seaded pole hetkel saadaval + Ei saanud ID-kaardilt andmeid lugeda + Rakendusesisene viga + ID-kaardilt loeti vigased andmed, proovi uuesti kaarti kasutada \ No newline at end of file diff --git a/MobileAuthApp/app/src/main/res/values/strings.xml b/MobileAuthApp/app/src/main/res/values/strings.xml index 9c2d2a7..ac0d78b 100644 --- a/MobileAuthApp/app/src/main/res/values/strings.xml +++ b/MobileAuthApp/app/src/main/res/values/strings.xml @@ -43,7 +43,9 @@ Put the ID card against the phone to establish connection Time left %d sek No time left - Wrong CAN + Unknown error + Wrong CAN + Connection between device and ID-card lost NAME @@ -73,4 +75,7 @@ HIDE **** Settings currently unavailable + Failed to read data from the ID-card + Internal error + Read bad data from the ID-card, try using the card again \ No newline at end of file