From 753b96e8fa8ed346de78de61d1c9f4a2e8fa6787 Mon Sep 17 00:00:00 2001 From: hunnihundert <47563806+hunnihundert@users.noreply.github.com> Date: Fri, 29 May 2020 16:52:28 +0900 Subject: [PATCH 1/2] changed input type for zip code input field in transcript info --- app/src/main/res/layout/fragment_transcript_info.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/src/main/res/layout/fragment_transcript_info.xml b/app/src/main/res/layout/fragment_transcript_info.xml index e9fce1b..4084895 100644 --- a/app/src/main/res/layout/fragment_transcript_info.xml +++ b/app/src/main/res/layout/fragment_transcript_info.xml @@ -192,7 +192,7 @@ android:autofillHints="postal-code" android:background="@drawable/rounded_white" android:error="@{viewModel.zipCodeError}" - android:inputType="number" + android:inputType="textPostalAddress" android:nextFocusDown="@id/editText_city_value" android:padding="10dp" android:text="@={viewModel.zipCode}" From f9efa7357589db5b42bade0213382c02da8652e2 Mon Sep 17 00:00:00 2001 From: hunnihundert <47563806+hunnihundert@users.noreply.github.com> Date: Wed, 3 Jun 2020 10:49:36 +0900 Subject: [PATCH 2/2] showing (backend) error message at registration in snackbar --- .../android/ui/auth/register/RegisterViewModel.kt | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/app/nexd/android/ui/auth/register/RegisterViewModel.kt b/app/src/main/java/app/nexd/android/ui/auth/register/RegisterViewModel.kt index b484c9f..785230e 100644 --- a/app/src/main/java/app/nexd/android/ui/auth/register/RegisterViewModel.kt +++ b/app/src/main/java/app/nexd/android/ui/auth/register/RegisterViewModel.kt @@ -124,20 +124,24 @@ class RegisterViewModel( } private fun handleErrors(throwable: Throwable) { + val errorMessage = mutableListOf() if (throwable is BackendError) { throwable.errorCodes.forEach { when (it) { USERS_USER_EXISTS -> { emailError.value = R.string.error_message_registration_user_already_exists + errorMessage.add(emailError.value!!) } VALIDATION_PASSWORD_TOO_SHORT -> { passwordError.value = R.string.error_message_registration_password_too_short passwordConfirmationError.value = R.string.error_message_registration_password_too_short + errorMessage.add(passwordConfirmationError.value!!) } VALIDATION_EMAIL_INVALID -> { emailError.value = R.string.error_message_registration_invalid_email + errorMessage.add(emailError.value!!) } else -> { Log.e( @@ -145,18 +149,15 @@ class RegisterViewModel( "Unknown error $it", throwable ) - + errorMessage.add(R.string.error_message_unknown) progress.value = Progress.Error() } } } - - progress.value = Progress.Error() - } - - if (progress.value !is Progress.Error) { - progress.value = Progress.Error(R.string.error_message_unknown) + } else { + errorMessage.add(R.string.error_message_unknown) } + progress.value = Progress.Error(errorMessage.first() ?: R.string.error_message_unknown) } } \ No newline at end of file