diff --git a/app/src/main/java/com/lateinit/rightweight/ui/MainViewModel.kt b/app/src/main/java/com/lateinit/rightweight/ui/MainViewModel.kt index b09f0b63..92b46ef0 100644 --- a/app/src/main/java/com/lateinit/rightweight/ui/MainViewModel.kt +++ b/app/src/main/java/com/lateinit/rightweight/ui/MainViewModel.kt @@ -89,6 +89,7 @@ class MainViewModel @Inject constructor( fun backup() { viewModelScope.launch() { + sendNetworkResultEvent(NetworkState.LOADING) backupUserInfo() backupMyRoutine() backupHistory() @@ -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() @@ -109,6 +111,7 @@ class MainViewModel @Inject constructor( userInfoInServer.completedDayId.value ) } + sendNetworkResultEvent(NetworkState.SUCCESS) } } diff --git a/app/src/main/java/com/lateinit/rightweight/ui/login/LoginViewModel.kt b/app/src/main/java/com/lateinit/rightweight/ui/login/LoginViewModel.kt index 8617bb5e..01a9438b 100644 --- a/app/src/main/java/com/lateinit/rightweight/ui/login/LoginViewModel.kt +++ b/app/src/main/java/com/lateinit/rightweight/ui/login/LoginViewModel.kt @@ -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 } \ No newline at end of file