diff --git a/app/src/main/java/app/cashadvisor/authorization/data/api/ResetPasswordApiService.kt b/app/src/main/java/app/cashadvisor/authorization/data/api/ResetPasswordApiService.kt index ff288d4..5e4e2e3 100644 --- a/app/src/main/java/app/cashadvisor/authorization/data/api/ResetPasswordApiService.kt +++ b/app/src/main/java/app/cashadvisor/authorization/data/api/ResetPasswordApiService.kt @@ -9,6 +9,7 @@ import app.cashadvisor.authorization.data.models.response.SaveNewPasswordRespons import retrofit2.http.Body import retrofit2.http.Headers import retrofit2.http.POST +import retrofit2.http.PUT interface ResetPasswordApiService { @@ -21,7 +22,7 @@ interface ResetPasswordApiService { suspend fun resetPasswordConfirm(@Body resetPasswordRequest: ResetPasswordWithCodeRequest):ConfirmResetPasswordResponse @Headers("Content-Type: application/json") - @POST("auth/login/reset/password") + @PUT("auth/login/reset/password/put") suspend fun saveNewPassword(@Body saveNewPasswordRequest: SaveNewPasswordRequest):SaveNewPasswordResponse } \ No newline at end of file diff --git a/app/src/main/java/app/cashadvisor/authorization/presentation/ui/LoginFragment.kt b/app/src/main/java/app/cashadvisor/authorization/presentation/ui/LoginFragment.kt index 8348269..3862cac 100644 --- a/app/src/main/java/app/cashadvisor/authorization/presentation/ui/LoginFragment.kt +++ b/app/src/main/java/app/cashadvisor/authorization/presentation/ui/LoginFragment.kt @@ -63,11 +63,9 @@ class LoginFragment : //navigation to support screen. It`s not exist yet } - etConfirmationCode.addTextChangedListener { - it?.let { code -> - if (code.length == 4) { - viewModel.confirmLoginUsingCode(requireContext(), code) - } + codeConfirmationView.setCallback { + if (it.length == 4) { + viewModel.confirmLoginUsingCode(requireContext(), it) } } @@ -112,7 +110,7 @@ class LoginFragment : tvSubtitle.text = getString(R.string.enter_account_data) clLoginForms.visibility = View.VISIBLE clConfirmationCode.visibility = View.GONE - etConfirmationCode.text?.clear() + codeConfirmationView.setCode("") btnLogin.isEnabled = state.isBtnLoginEnabled manageEmailValidation(state.emailState) @@ -266,14 +264,14 @@ class LoginFragment : is LoginScreenMessageContent.ConfirmationCodeMessage -> { showSnackbar( content.message, - etConfirmationCode + codeConfirmationView ) } } } } - private fun showSnackbar(message: String, viewToFocus: TextInputEditText) { + private fun showSnackbar(message: String, viewToFocus: View) { hideKeyboard() Snackbar.make(binding.root, message, SNACKBAR_DURATION) .setBackgroundTint(resources.getColor(R.color.black, null)) diff --git a/app/src/main/java/app/cashadvisor/authorization/presentation/viewmodel/LoginViewModel.kt b/app/src/main/java/app/cashadvisor/authorization/presentation/viewmodel/LoginViewModel.kt index 47baed8..0c4a00d 100644 --- a/app/src/main/java/app/cashadvisor/authorization/presentation/viewmodel/LoginViewModel.kt +++ b/app/src/main/java/app/cashadvisor/authorization/presentation/viewmodel/LoginViewModel.kt @@ -320,12 +320,12 @@ class LoginViewModel @Inject constructor( } } - fun confirmLoginUsingCode(context: Context, confirmationCode: Editable?) { + fun confirmLoginUsingCode(context: Context, confirmationCode: String) { viewModelScope.launch(Dispatchers.IO) { val result = loginInteractor.confirmLoginByEmailWithCode( Email(emailInput), - ConfirmCode(confirmationCode.toString()) + ConfirmCode(confirmationCode) ) when (result) { @@ -387,15 +387,6 @@ class LoginViewModel @Inject constructor( result.error.lockDuration if (result.error.lockDuration > 0) { - /*_messageEvent.emit( - LoginScreenMessageContent.ConfirmationCodeMessage( - context.getString( - R.string.wrong_code_number_lock_duration, - getRightEndingMinutes(minutesLeft.toInt()) - ) - ) - )*/ - _sideEffects.emit(LoginScreenSideEffects.FailedToConfirmLogin(getRightEndingMinutes(minutesLeft.toInt()))) } else { diff --git a/app/src/main/res/layout/fragment_login.xml b/app/src/main/res/layout/fragment_login.xml index 01a2cb6..8dee629 100644 --- a/app/src/main/res/layout/fragment_login.xml +++ b/app/src/main/res/layout/fragment_login.xml @@ -44,7 +44,8 @@ android:layout_height="wrap_content" android:layout_marginHorizontal="@dimen/login_screen_basic_horizontal_margin" android:layout_marginTop="@dimen/login_screen_forms_top_margin" - android:visibility="visible"> + android:visibility="visible" + tools:visibility="gone"> @@ -125,10 +126,10 @@ android:layout_height="@dimen/login_screen_progress_bar_size" android:indeterminateTint="@color/black" android:visibility="gone" - app:layout_constraintStart_toStartOf="@id/btn_login" + app:layout_constraintBottom_toBottomOf="@id/btn_login" app:layout_constraintEnd_toEndOf="@id/btn_login" - app:layout_constraintTop_toTopOf="@id/btn_login" - app:layout_constraintBottom_toBottomOf="@id/btn_login"/> + app:layout_constraintStart_toStartOf="@id/btn_login" + app:layout_constraintTop_toTopOf="@id/btn_login" /> + tools:visibility="visible"> - - - - + app:layout_constraintTop_toBottomOf="@id/tv_enter_confirmation_code" + app:symbolFont="@font/gilroysemibold" + app:symbolTextColor="@color/black" + /> + app:layout_constraintTop_toBottomOf="@id/tv_enter_confirmation_code" /> 52dp 1dp 80dp + 40dp + 75dp + 2dp 24dp + 85dp 16sp