π :: (#216) - νμκ°μ api μ°κ²°μ νμμ΅λλ€ - #216
Conversation
β¦p-api-connection
| modifier = modifier | ||
| .fillMaxWidth() | ||
| .border(width = 1.dp, color = colors.gray100, shape = RoundedCornerShape(size = 8.dp)) | ||
| .border(width = 1.dp, color = if(selected) colors.main.copy(alpha = 0.5f) else colors.gray100, shape = RoundedCornerShape(size = 8.dp)) |
There was a problem hiding this comment.
μμ νμμ΅λλ€
| navigateToSignIn: () -> Unit, | ||
| viewModel: SignUpViewModel = hiltViewModel() | ||
| ) { | ||
| val verificationCodeUiState by viewModel.verificationCodeUiState.collectAsStateWithLifecycle() |
There was a problem hiding this comment.
μ§κΈμ ViewModelμ UI μνκ° μ¬λ¬ StateFlowλ‘ ν©μ΄μ Έ μλλ°, μ΄λ₯Ό νλμ UiState λ°μ΄ν° ν΄λμ€λ‘ λ¬Άμ΄μ λ¨μΌ StateFlowλ‘ κ΄λ¦¬νλ©΄ λ λͺ ννκ³ μ μ§λ³΄μκ° μ¬μΈ κ² κ°μ΅λλ€
There was a problem hiding this comment.
μμ νμμ΅λλ€
| } | ||
|
|
||
| if (showCodeInput) { | ||
| val timeText = String.format("%02d:%02d", remainingTime / 60, remainingTime % 60) |
There was a problem hiding this comment.
μ΄λ° λ‘μ§μ ν¨μνν΄μ ui:utilλ‘ μ΄λνλκ² μ’μκ² κ°μ΅λλ€
There was a problem hiding this comment.
μ¬κΈ°μλ§ μ¬μ©νλ μκ° λ‘μ§μ΄μ¬μ ν¨μλ‘ λΉΌμ§ μμμ΅λλ€
| setEmailValidated(true) | ||
| } | ||
| } else { | ||
| coroutineScope.launch { |
There was a problem hiding this comment.
coroutineScope.launch μ¬μ©μ΄ λΆνμν΄λ³΄μ
λλ€
There was a problem hiding this comment.
μμ νμμ΅λλ€
| val passwordValid = password.length >= 8 && | ||
| listOf( | ||
| Regex(".*[a-zA-Z].*").containsMatchIn(passwordTextState), | ||
| Regex(".*[0-9].*").containsMatchIn(passwordTextState), | ||
| Regex(".*[!@#\$%^&*(),.?\":{}|<>\\[\\]~`\\\\/;'+=-_].*").containsMatchIn(passwordTextState) | ||
| Regex(".*[a-zA-Z].*").containsMatchIn(password), | ||
| Regex(".*[0-9].*").containsMatchIn(password), | ||
| Regex(".*[!@#\$%^&*(),.?\":{}|<>\\[\\]~`\\\\/;'+=-_].*").containsMatchIn( | ||
| password | ||
| ) | ||
| ).count { it } >= 2 |
There was a problem hiding this comment.
μ΄λ° λ‘μ§μ domain:utilμΌλ‘ μ΄λνλκ² μ’μ보μ λλ€
There was a problem hiding this comment.
μ¬κΈ°μλ§ μ¬μ©νλ λ‘μ§μ΄μ¬μ κ΅³μ΄ λλ©μΈ μ νΈλ‘ μ΄λνμ§ μμμ΅λλ€
| } | ||
|
|
||
| private fun verificationCode(body: VerificationCodeModel) = viewModelScope.launch { | ||
| _verificationCodeUiState.value = VerificationCodeUiState.Loading |
There was a problem hiding this comment.
μ΄κΈ°κ°μ onStartν¨μλ₯Ό μ¬μ©νλκ²μ΄ μ§κ΄μ μΌκ² κ°μ΅λλ€
There was a problem hiding this comment.
νΉμ μμΈν 컀λ©νΈ λ¨κ²¨μ£Όμ€μ μμκΉμ¬?
There was a problem hiding this comment.
private fun verificationEmail(body: VerificationEmailModel) = viewModelScope.launch {
verificationEmailUseCase(body)
.onStart {
_verificationEmailUiState.value = VerificationEmailUiState.Loading
}
.catch { e ->
Logger.e("SignUPViewModel", "μΈμ¦ λ©μΌ 보λ΄κΈ° μ€ν¨: ${e.message}")
_verificationEmailUiState.value = VerificationEmailUiState.Error(e.message ?: "Unknown error")
}
.collect {
Logger.d("SignUPViewModel", "μΈμ¦ λ©μΌ 보λ΄κΈ° μ±κ³΅")
_verificationEmailUiState.value = VerificationEmailUiState.Success
}
}There was a problem hiding this comment.
μ¬μ©νμ§ μλκ²λ μΆ©λΆν μ§κ΄μ μ΄λ€κ³ μκ°ν©λλ€
| internal fun startResendTimer() { | ||
| viewModelScope.launch { | ||
| _isResendEnabled.value = false | ||
| _remainingTime.value = 60 | ||
|
|
||
| while (_remainingTime.value > 0) { | ||
| delay(1000) | ||
| _remainingTime.value = _remainingTime.value - 1 | ||
| } | ||
|
|
||
| _isResendEnabled.value = true | ||
| } | ||
| } |
There was a problem hiding this comment.
μΈμ¦λ²νΈ λ°μ‘νμ μ±μ΄ onPause μνμΌλ νμ΄λ¨Έκ° μλνμ§ μμ κ² κ°μ΅λλ€
There was a problem hiding this comment.
λ΅ μ μλν©λλ€
π‘ κ°μ
νμκ°μ api μ°κ²°μ νμμ΅λλ€
π μμ λ΄μ©
π λ³κ²½μ¬ν
X
πββοΈ μ§λ¬Έμ¬ν
X
π΄ μ¬μ©λ°©λ²
X
πΈ κΈ°ν
X