Skip to content

Commit

Permalink
Issue #202 feat: Loading state상태 정의
Browse files Browse the repository at this point in the history
  • Loading branch information
TRASALBY committed Dec 12, 2022
1 parent 7f90c6d commit e4517c1
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ class MainViewModel @Inject constructor(

fun backup() {
viewModelScope.launch() {
sendNetworkResultEvent(NetworkState.LOADING)
backupUserInfo()
backupMyRoutine()
backupHistory()
Expand All @@ -99,6 +100,7 @@ class MainViewModel @Inject constructor(
fun restore(){
val userId = userInfo.value?.userId ?: return
viewModelScope.launch(networkExceptionHandler) {
sendNetworkResultEvent(NetworkState.LOADING)
val userInfoInServer = userRepository.restoreUserInfo(userId)
if(userInfoInServer != null){
restoreRoutine()
Expand All @@ -109,6 +111,7 @@ class MainViewModel @Inject constructor(
userInfoInServer.completedDayId.value
)
}
sendNetworkResultEvent(NetworkState.SUCCESS)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,5 +51,5 @@ class LoginViewModel @Inject constructor(
}

enum class NetworkState {
NO_ERROR, BAD_INTERNET, PARSE_ERROR, WRONG_CONNECTION, OTHER_ERROR, SUCCESS
NO_ERROR, BAD_INTERNET, PARSE_ERROR, WRONG_CONNECTION, OTHER_ERROR, SUCCESS, LOADING
}

0 comments on commit e4517c1

Please sign in to comment.