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

Commit dae1667f authored by Hasib Prince's avatar Hasib Prince
Browse files

removed redundant login failed dialog

parent 203974c7
Loading
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -139,11 +139,6 @@ class MainActivity : AppCompatActivity() {
                    )
                } else if (exception != null) {
                    Timber.e(exception, "Login failed! message: ${exception?.localizedMessage}")
                    ApplicationDialogFragment(
                        title = getString(R.string.sign_in_failed_title),
                        message = getString(R.string.sign_in_failed_desc),
                        positiveButtonText = getString(R.string.ok)
                    ).show(supportFragmentManager, TAG)
                }
            }
        }
+12 −9
Original line number Diff line number Diff line
@@ -35,13 +35,16 @@ import com.aurora.gplayapi.helpers.SearchHelper
import com.aurora.gplayapi.helpers.TopChartsHelper
import dagger.hilt.android.qualifiers.ApplicationContext
import foundation.e.apps.R
import foundation.e.apps.data.enums.User
import foundation.e.apps.data.fused.utils.CategoryType
import foundation.e.apps.data.gplay.utils.GPlayHttpClient
import foundation.e.apps.data.login.LoginSourceRepository
import foundation.e.apps.data.login.exceptions.GPlayLoginException
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.withContext
import timber.log.Timber
import javax.inject.Inject
import kotlin.math.log

class GplayStoreRepositoryImpl @Inject constructor(
    @ApplicationContext private val context: Context,
@@ -52,7 +55,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
    override suspend fun getHomeScreenData(): Any {
        val homeScreenData = mutableMapOf<String, List<App>>()
        val homeElements = createTopChartElements()
        val authData = loginSourceRepository.gplayAuth ?: return homeScreenData
        val authData = loginSourceRepository.gplayAuth!!

        homeElements.forEach {
            val chart = it.value.keys.iterator().next()
@@ -77,7 +80,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
        query: String,
        subBundle: MutableSet<SearchBundle.SubBundle>?
    ): Pair<List<App>, MutableSet<SearchBundle.SubBundle>> {
        var authData = loginSourceRepository.gplayAuth ?: return Pair(emptyList(), mutableSetOf())
        var authData = loginSourceRepository.gplayAuth!!
        val searchHelper =
            SearchHelper(authData).using(gPlayHttpClient)

@@ -102,7 +105,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
    }

    override suspend fun getSearchSuggestions(query: String): List<SearchSuggestEntry> {
        val authData = loginSourceRepository.gplayAuth ?: return listOf()
        val authData = loginSourceRepository.gplayAuth!!

        val searchData = mutableListOf<SearchSuggestEntry>()
        withContext(Dispatchers.IO) {
@@ -113,7 +116,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
    }

    override suspend fun getAppsByCategory(category: String, pageUrl: String?): StreamCluster {
        val authData = loginSourceRepository.gplayAuth ?: return StreamCluster()
        val authData = loginSourceRepository.gplayAuth!!

        val subCategoryHelper =
            CategoryAppsHelper(authData).using(gPlayHttpClient)
@@ -131,7 +134,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
            return categoryList
        }

        val authData = loginSourceRepository.gplayAuth ?: return categoryList
        val authData = loginSourceRepository.gplayAuth!!

        withContext(Dispatchers.IO) {
            val categoryHelper = CategoryHelper(authData).using(gPlayHttpClient)
@@ -142,7 +145,7 @@ class GplayStoreRepositoryImpl @Inject constructor(

    override suspend fun getAppDetails(packageNameOrId: String): App? {
        var appDetails: App?
        val authData = loginSourceRepository.gplayAuth ?: return null
        val authData = loginSourceRepository.gplayAuth!!

        withContext(Dispatchers.IO) {
            val appDetailsHelper = AppDetailsHelper(authData).using(gPlayHttpClient)
@@ -153,7 +156,7 @@ class GplayStoreRepositoryImpl @Inject constructor(

    override suspend fun getAppsDetails(packageNamesOrIds: List<String>): List<App> {
        val appDetailsList = mutableListOf<App>()
        val authData = loginSourceRepository.gplayAuth ?: return appDetailsList
        val authData = loginSourceRepository.gplayAuth!!

        withContext(Dispatchers.IO) {
            val appDetailsHelper = AppDetailsHelper(authData).using(gPlayHttpClient)
@@ -185,7 +188,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
        offerType: Int
    ): List<File> {
        val downloadData = mutableListOf<File>()
        val authData = loginSourceRepository.gplayAuth ?: return downloadData
        val authData = loginSourceRepository.gplayAuth!!

        withContext(Dispatchers.IO) {
            val version = versionCode?.let { it as Int } ?: -1
@@ -202,7 +205,7 @@ class GplayStoreRepositoryImpl @Inject constructor(
        offerType: Int
    ): List<File> {
        val downloadData = mutableListOf<File>()
        val authData = loginSourceRepository.gplayAuth ?: return downloadData
        val authData = loginSourceRepository.gplayAuth!!

        withContext(Dispatchers.IO) {
            val purchaseHelper = PurchaseHelper(authData).using(gPlayHttpClient)
+4 −0
Original line number Diff line number Diff line
@@ -36,6 +36,10 @@ class LoginCommon @Inject constructor(
        loginDataStore.saveUserType(user)
    }

    fun getUserType(): User {
        return loginDataStore.getUserType()
    }

    suspend fun saveGoogleLogin(email: String, oauth: String) {
        loginDataStore.saveGoogleLogin(email, oauth)
    }
+7 −0
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package foundation.e.apps.data.login
import com.aurora.gplayapi.data.models.AuthData
import foundation.e.apps.data.ResultSupreme
import foundation.e.apps.data.enums.User
import foundation.e.apps.data.login.exceptions.GPlayLoginException
import javax.inject.Inject
import javax.inject.Singleton

@@ -31,6 +32,8 @@ class LoginSourceRepository @Inject constructor(
) {

    var gplayAuth: AuthData? = null
        get() = field ?: throw GPlayLoginException(false, "AuthData is not available!", getUserType())

    suspend fun getAuthObjects(clearAuthTypes: List<String> = listOf()): List<AuthObject> {

        val authObjectsLocal = ArrayList<AuthObject>()
@@ -71,4 +74,8 @@ class LoginSourceRepository @Inject constructor(
        this.gplayAuth = validateAuthData.data
        return validateAuthData
    }

    private fun getUserType(): User {
        return loginCommon.getUserType()
    }
}