Skip to content

Commit

Permalink
[REFACTOR] #86 : viewModelScope 안, viewModelScope -> suspend 함수로 변경하여…
Browse files Browse the repository at this point in the history
…, 하나의 viewModelScope 내에서 동작하도록 수정
  • Loading branch information
jeongjaino committed Jan 12, 2024
1 parent ab91fa7 commit 942757e
Showing 1 changed file with 10 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,17 @@ class SplashViewModel @Inject constructor(
}
}

private fun isUserSignIn() {
viewModelScope.launch {
isUserSignInUseCase()
.onSuccess { isSignIn ->
if (isSignIn) {
_splashUiEvent.emit(SplashEvent.SignInUser)
} else {
_splashUiEvent.emit(SplashEvent.NonSignInUser)
}
}.onFailure { throwable ->
_splashUiEvent.emit(SplashEvent.Failure(throwable))
private suspend fun isUserSignIn() {
isUserSignInUseCase()
.onSuccess { isSignIn ->
if (isSignIn) {
_splashUiEvent.emit(SplashEvent.SignInUser)
} else {
_splashUiEvent.emit(SplashEvent.NonSignInUser)
}
}
}.onFailure { throwable ->
_splashUiEvent.emit(SplashEvent.Failure(throwable))
}
}

sealed class SplashEvent {
Expand Down

0 comments on commit 942757e

Please sign in to comment.