Skip to content

Commit

Permalink
#15 [fix] livedata 업데이트 함수 분리
Browse files Browse the repository at this point in the history
  • Loading branch information
stellar-halo committed Dec 7, 2023
1 parent 17c96bb commit 84b786f
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,12 @@ class SignUpViewModel @Inject constructor(
}
}

fun updatePasswordMeetCriteria() {
_isPasswordMeetCriteria.value = isPasswordRegexMatch()
}

fun updateIsMeetCriteria() {
_isMeetCriteria.value = (isIdRegexMatch() && isPasswordRegexMatch())
_isMeetCriteria.value = isSignUpAvailable()
}

fun isSignUpAvailable() =
Expand All @@ -61,10 +65,8 @@ class SignUpViewModel @Inject constructor(
return id.value?.let { ID_REGEX.matcher(it).find() } ?: false
}

fun isPasswordRegexMatch(): Boolean {
val pwRegexMatch = password.value?.let { PASSWORD_REGEX.matcher(it).find() } ?: false
_isPasswordMeetCriteria.value = pwRegexMatch
return pwRegexMatch
private fun isPasswordRegexMatch(): Boolean {
return password.value?.let { PASSWORD_REGEX.matcher(it).find() } ?: false
}

companion object {
Expand Down

0 comments on commit 84b786f

Please sign in to comment.