Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5129608a authored by Nishant Dande's avatar Nishant Dande
Browse files

Modified as per review comment

parent f1ce1c46
Loading
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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"
}
+5 −4
Original line number Diff line number Diff line
@@ -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
@@ -112,7 +113,7 @@ class LoginViewModel @Inject constructor(
                        LoginState(
                            isLoading = false,
                            isLoggedIn = false,
                            error = "Google login failed"
                            error = Constants.GOOGLE_LOGIN_FAIL
                        )
                }
            } else {
@@ -120,7 +121,7 @@ class LoginViewModel @Inject constructor(
                    LoginState(
                        isLoading = false,
                        isLoggedIn = false,
                        error = "Google login failed"
                        error = Constants.GOOGLE_LOGIN_FAIL
                    )
            }

@@ -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
                            )
                        }

@@ -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
                        }
                    }
+6 −3
Original line number Diff line number Diff line
@@ -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
@@ -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()
@@ -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()
        }