Skip to content

Commit

Permalink
Making layout, fragment and viewModel for loginScreen including pin c…
Browse files Browse the repository at this point in the history
…ode(confirmation code) stage.
  • Loading branch information
alexxk2 committed Mar 15, 2024
1 parent 7e7a02a commit f915389
Show file tree
Hide file tree
Showing 50 changed files with 1,694 additions and 59 deletions.
1 change: 1 addition & 0 deletions app/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
tools:targetApi="31">
<activity
android:name=".main.presentation.ui.MainActivity"
android:screenOrientation="portrait"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@ class NetworkToLoginExceptionMapper @Inject constructor(
private fun handleCommonException(exception: NetworkException): LoginException {
return when (exception) {
is NetworkException.NoInternetConnection -> {
val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
LoginException.NoConnection(errorResponse.message)
//val errorResponse = handleErrorResponse<ErrorResponse>(exception.errorBody)
LoginException.NoConnection(message = exception.errorBody)
}

is NetworkException.Undefined -> {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
package app.cashadvisor.authorization.data.models.response.customError

import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable

@Serializable
data class ErrorWrongConfirmationCodeResponse(
@SerialName("remaining_attempts") val remainingAttempts: Int,
@SerialName("lock_duration") val lockDuration: Int,
@SerialName("lock_duration") val lockDuration: Long,
val error: String,
@SerialName("status_code") val statusCode: Int
)
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@ class InputValidationInteractorImpl @Inject constructor() : InputValidationInter
}

override suspend fun validatePassword(password: String): PasswordValidationState {
if (password.length < 8) {
return PasswordValidationState.Error(
password = Password(EMPTY_VALUE),
passwordValidationError = PasswordValidationError.PASSWORD_IS_NOT_LONG_ENOUGH
)
}
val isPasswordValid = isValidText(password.trimStart().trimEnd(), REGEX_PATTERN_PASSWORD)
return if (isPasswordValid) {
PasswordValidationState.Success(Password(value = password))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
package app.cashadvisor.authorization.domain.models

enum class PasswordValidationError {
PASSWORD_NOT_VALID
PASSWORD_NOT_VALID, PASSWORD_IS_NOT_LONG_ENOUGH
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ sealed interface EmailValidationState {
val email: Email,
val emailValidationError: EmailValidationError
) : EmailValidationState
data object Default: EmailValidationState
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ sealed interface PasswordValidationState {
val password: Password,
val passwordValidationError: PasswordValidationError
) : PasswordValidationState
data object Default : PasswordValidationState
}
Loading

0 comments on commit f915389

Please sign in to comment.