Loading app/src/main/java/foundation/e/apps/data/Constants.kt +3 −0 Original line number Diff line number Diff line Loading @@ -9,4 +9,7 @@ object Constants { const val ACTION_AUTHDATA_DUMP = "foundation.e.apps.action.DUMP_GACCOUNT_INFO" const val TAG_AUTHDATA_DUMP = "AUTHDATA_DUMP" const val GOOGLE_LOGIN_FAIL = "Google login failed" const val UNEXPECTED_ERROR = "An unexpected error occurred" } app/src/main/java/foundation/e/apps/presentation/login/LoginViewModel.kt +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.aurora.gplayapi.data.models.AuthData import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.data.Constants import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.enums.User.NO_GOOGLE Loading Loading @@ -112,7 +113,7 @@ class LoginViewModel @Inject constructor( LoginState( isLoading = false, isLoggedIn = false, error = "Google login failed" error = Constants.GOOGLE_LOGIN_FAIL ) } } else { Loading @@ -120,7 +121,7 @@ class LoginViewModel @Inject constructor( LoginState( isLoading = false, isLoggedIn = false, error = "Google login failed" error = Constants.GOOGLE_LOGIN_FAIL ) } Loading Loading @@ -197,7 +198,7 @@ class LoginViewModel @Inject constructor( is Resource.Error -> { _loginState.value = LoginState( error = result.message ?: "An unexpected error occured" error = result.message ?: Constants.UNEXPECTED_ERROR ) } Loading Loading @@ -228,7 +229,7 @@ class LoginViewModel @Inject constructor( is Resource.Error -> { val error = it.message.let { message -> when (message) { null -> "An unexpected error occurred" null -> Constants.UNEXPECTED_ERROR else -> message } } Loading app/src/main/java/foundation/e/apps/presentation/settings/SettingsViewModel.kt +6 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.data.Constants import foundation.e.apps.domain.settings.usecase.SettingsUseCase import foundation.e.apps.utils.Resource import kotlinx.coroutines.flow.collect Loading @@ -49,7 +50,7 @@ class SettingsViewModel @Inject constructor( } is Resource.Error -> { _currentUserState.value = settingUserState.apply { error = result.message ?: "An unexpected error occurred" } settingUserState.apply { error = result.message ?: Constants.UNEXPECTED_ERROR } } is Resource.Loading -> TODO() Loading @@ -68,10 +69,12 @@ class SettingsViewModel @Inject constructor( } is Resource.Error -> { _currentUserState.value = settingUserState.apply { error = result.message ?: "An unexpected error occurred" } settingUserState.apply { error = result.message ?: Constants.UNEXPECTED_ERROR } } is Resource.Loading -> TODO() is Resource.Loading -> { // NO NEED } } }.collect() } Loading Loading
app/src/main/java/foundation/e/apps/data/Constants.kt +3 −0 Original line number Diff line number Diff line Loading @@ -9,4 +9,7 @@ object Constants { const val ACTION_AUTHDATA_DUMP = "foundation.e.apps.action.DUMP_GACCOUNT_INFO" const val TAG_AUTHDATA_DUMP = "AUTHDATA_DUMP" const val GOOGLE_LOGIN_FAIL = "Google login failed" const val UNEXPECTED_ERROR = "An unexpected error occurred" }
app/src/main/java/foundation/e/apps/presentation/login/LoginViewModel.kt +5 −4 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import com.aurora.gplayapi.data.models.AuthData import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.data.Constants import foundation.e.apps.data.ResultSupreme import foundation.e.apps.data.enums.User import foundation.e.apps.data.enums.User.NO_GOOGLE Loading Loading @@ -112,7 +113,7 @@ class LoginViewModel @Inject constructor( LoginState( isLoading = false, isLoggedIn = false, error = "Google login failed" error = Constants.GOOGLE_LOGIN_FAIL ) } } else { Loading @@ -120,7 +121,7 @@ class LoginViewModel @Inject constructor( LoginState( isLoading = false, isLoggedIn = false, error = "Google login failed" error = Constants.GOOGLE_LOGIN_FAIL ) } Loading Loading @@ -197,7 +198,7 @@ class LoginViewModel @Inject constructor( is Resource.Error -> { _loginState.value = LoginState( error = result.message ?: "An unexpected error occured" error = result.message ?: Constants.UNEXPECTED_ERROR ) } Loading Loading @@ -228,7 +229,7 @@ class LoginViewModel @Inject constructor( is Resource.Error -> { val error = it.message.let { message -> when (message) { null -> "An unexpected error occurred" null -> Constants.UNEXPECTED_ERROR else -> message } } Loading
app/src/main/java/foundation/e/apps/presentation/settings/SettingsViewModel.kt +6 −3 Original line number Diff line number Diff line Loading @@ -23,6 +23,7 @@ import androidx.lifecycle.MutableLiveData import androidx.lifecycle.ViewModel import androidx.lifecycle.viewModelScope import dagger.hilt.android.lifecycle.HiltViewModel import foundation.e.apps.data.Constants import foundation.e.apps.domain.settings.usecase.SettingsUseCase import foundation.e.apps.utils.Resource import kotlinx.coroutines.flow.collect Loading @@ -49,7 +50,7 @@ class SettingsViewModel @Inject constructor( } is Resource.Error -> { _currentUserState.value = settingUserState.apply { error = result.message ?: "An unexpected error occurred" } settingUserState.apply { error = result.message ?: Constants.UNEXPECTED_ERROR } } is Resource.Loading -> TODO() Loading @@ -68,10 +69,12 @@ class SettingsViewModel @Inject constructor( } is Resource.Error -> { _currentUserState.value = settingUserState.apply { error = result.message ?: "An unexpected error occurred" } settingUserState.apply { error = result.message ?: Constants.UNEXPECTED_ERROR } } is Resource.Loading -> TODO() is Resource.Loading -> { // NO NEED } } }.collect() } Loading