Skip to content

Commit

Permalink
Merge branch 'dev' into 71-Password-recovery-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MajoritySky2496 authored Jun 28, 2024
2 parents 2876b24 + fd651d1 commit fbfc87b
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
}

Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down Expand Up @@ -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 {
Expand Down
48 changes: 25 additions & 23 deletions app/src/main/res/layout/fragment_login.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">

<TextView
android:id="@+id/tv_enter_email"
Expand Down Expand Up @@ -92,8 +93,8 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/login_screen_edit_text_top_margin"
app:helperTextTextColor="@color/subcolor_2"
app:helperTextTextAppearance="@style/Widget.CashAdvisor.Text.Subtext"
app:helperTextTextColor="@color/subcolor_2"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_enter_password">
Expand Down Expand Up @@ -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" />

<TextView
android:id="@+id/tv_forget_password"
Expand All @@ -153,7 +154,7 @@
android:layout_marginHorizontal="@dimen/login_screen_basic_horizontal_margin"
android:layout_marginTop="@dimen/login_screen_forms_top_margin"
android:visibility="gone"
tools:visibility="gone">
tools:visibility="visible">

<TextView
android:id="@+id/tv_enter_confirmation_code"
Expand All @@ -165,30 +166,31 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/ti_confirmation_code"
style="@style/TextInputLayout"
android:layout_width="0dp"
<app.cashadvisor.customView.CodeConfirmationView
android:id="@+id/code_confirmation_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/login_screen_edit_text_top_margin"
app:symbolHeight="@dimen/login_screen_pin_code_symbol_height"
app:symbolWidth="@dimen/login_screen_pin_code_symbol_width"
app:symbolsSpacing="0dp"
app:backgroundColour="@color/bg1"
app:backgroundCornerRadius="12dp"
app:borderColor="@color/subcolour2"
app:borderWidth="@dimen/login_screen_pin_code_border_width"
app:codeLength="4"
android:layout_marginTop="5dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tv_enter_confirmation_code">

<com.google.android.material.textfield.TextInputEditText
android:id="@+id/et_confirmation_code"
style="@style/EditText"
android:inputType="number"
android:maxLength="4"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</com.google.android.material.textfield.TextInputLayout>
app:layout_constraintTop_toBottomOf="@id/tv_enter_confirmation_code"
app:symbolFont="@font/gilroysemibold"
app:symbolTextColor="@color/black"
/>

<TextView
android:id="@+id/tv_send_again"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/login_screen_btn_send_again_top_margin"
android:layout_marginTop="@dimen/login_screen_send_again_margin_top"
android:paddingVertical="@dimen/login_screen_text_input_vertical_padding"
android:text="@string/send_confirmation_code_again"
android:textAlignment="center"
Expand All @@ -198,7 +200,7 @@
app:layout_constraintHorizontal_bias="0.5"
app:layout_constraintHorizontal_chainStyle="spread_inside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ti_confirmation_code" />
app:layout_constraintTop_toBottomOf="@id/tv_enter_confirmation_code" />

<TextView
android:id="@+id/tv_cant_get_code"
Expand Down
4 changes: 4 additions & 0 deletions uikit/src/main/res/values/dimens.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,11 @@
<dimen name="login_screen_btn_send_again_top_margin">52dp</dimen>
<dimen name="login_screen_edit_text_stroke_width">1dp</dimen>
<dimen name="login_screen_login_btn_top_margin">80dp</dimen>
<dimen name="login_screen_pin_code_symbol_height">40dp</dimen>
<dimen name="login_screen_pin_code_symbol_width">75dp</dimen>
<dimen name="login_screen_pin_code_border_width">2dp</dimen>
<dimen name="login_screen_progress_bar_size">24dp</dimen>
<dimen name="login_screen_send_again_margin_top">85dp</dimen>
<dimen name="symbol_view_text_size">16sp</dimen>

<!--Recovery screen-->
Expand Down

0 comments on commit fbfc87b

Please sign in to comment.