Skip to content

Commit

Permalink
[chore] 닉네임 중복 검사 딜레이 감소
Browse files Browse the repository at this point in the history
  • Loading branch information
jiwon2724 committed Aug 28, 2024
1 parent 58dd79b commit 7a15960
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class LoginViewModel @Inject constructor(
fun checkDuplicateNickname(nickname: String) {
duplicateNicknameJob?.cancel()
duplicateNicknameJob = viewModelScope.launch {
delay(1.second())
delay(0.5.second())
when (val duplicateNicknameResult = nicknameUseCase.checkDuplicateNickname(nickname)) {
is PokitResult.Success -> {
_inputNicknameState.update { duplicateNicknameState ->
Expand Down Expand Up @@ -195,6 +195,10 @@ class LoginViewModel @Inject constructor(
return (this * 1000L)
}

private fun Double.second(): Long {
return (this * 1000L).toLong()
}

private const val LIMIT_SELECTED_COUNT = 3
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ class SettingViewModel @Inject constructor(
fun checkDuplicateNickname(nickname: String) {
duplicateNicknameJob?.cancel()
duplicateNicknameJob = viewModelScope.launch {
delay(1.second())
delay(0.5.second())
when (val duplicateNicknameResult = nicknameUseCase.checkDuplicateNickname(nickname)) {
is PokitResult.Success -> {
_inputNicknameState.update { duplicateNicknameState ->
Expand Down Expand Up @@ -115,6 +115,10 @@ class SettingViewModel @Inject constructor(
private fun Int.second(): Long {
return (this * 1000L)
}

private fun Double.second(): Long {
return (this * 1000L).toLong()
}
}
}

Expand Down

0 comments on commit 7a15960

Please sign in to comment.