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

Commit 8bfa49e4 authored by Sayantan Roychowdhury's avatar Sayantan Roychowdhury
Browse files

Issue 6342: Fix updates error when GPlay source is unchecked

parent 184e5085
Loading
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -109,8 +109,12 @@ class FusedAPIImpl @Inject constructor(
        return true
    }

    fun getApplicationCategoryPreference(): String {
        return preferenceManagerModule.preferredApplicationType()
    fun getApplicationCategoryPreference(): List<String> {
        val prefs = mutableListOf<String>()
        if (preferenceManagerModule.isGplaySelected()) prefs.add(APP_TYPE_ANY)
        if (preferenceManagerModule.isOpenSourceSelected()) prefs.add(APP_TYPE_OPEN)
        if (preferenceManagerModule.isPWASelected()) prefs.add(APP_TYPE_PWA)
        return prefs
    }

    suspend fun getHomeScreenData(
+1 −1
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ class FusedAPIRepository @Inject constructor(private val fusedAPIImpl: FusedAPII
        return fusedAPIImpl.isFusedHomesEmpty(fusedHomes)
    }

    fun getApplicationCategoryPreference(): String {
    fun getApplicationCategoryPreference(): List<String> {
        return fusedAPIImpl.getApplicationCategoryPreference()
    }

+1 −1
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class HomeViewModel @Inject constructor(
        }
    }

    fun getApplicationCategoryPreference(): String {
    fun getApplicationCategoryPreference(): List<String> {
        return fusedAPIRepository.getApplicationCategoryPreference()
    }

+1 −1
Original line number Diff line number Diff line
@@ -115,7 +115,7 @@ class UpdatesViewModel @Inject constructor(
        return false
    }

    fun getApplicationCategoryPreference(): String {
    fun getApplicationCategoryPreference(): List<String> {
        return updatesManagerRepository.getApplicationCategoryPreference()
    }

+18 −13
Original line number Diff line number Diff line
@@ -20,6 +20,7 @@ package foundation.e.apps.updates.manager

import com.aurora.gplayapi.data.models.AuthData
import foundation.e.apps.api.faultyApps.FaultyAppRepository
import foundation.e.apps.api.fused.FusedAPIImpl.Companion.APP_TYPE_ANY
import foundation.e.apps.api.fused.FusedAPIRepository
import foundation.e.apps.api.fused.data.FusedApp
import foundation.e.apps.manager.pkg.PkgManagerModule
@@ -63,6 +64,7 @@ class UpdatesManagerImpl @Inject constructor(
                }
            }

            if (getApplicationCategoryPreference().contains(APP_TYPE_ANY)) {
                // Check for remaining apps from GPlay
                val gPlayResult = fusedAPIRepository.getApplicationDetails(
                    pkgList,
@@ -70,7 +72,9 @@ class UpdatesManagerImpl @Inject constructor(
                    Origin.GPLAY
                )
                gPlayResult.first.forEach {
                if (it.status == Status.UPDATABLE && it.filterLevel.isUnFiltered()) updateList.add(it)
                    if (it.status == Status.UPDATABLE && it.filterLevel.isUnFiltered()) updateList.add(
                        it
                    )
                }
                gPlayResult.second.let {
                    if (it != ResultStatus.OK) {
@@ -78,6 +82,7 @@ class UpdatesManagerImpl @Inject constructor(
                    }
                }
            }
        }
        val nonFaultyUpdateList = faultyAppRepository.removeFaultyApps(updateList)
        return Pair(nonFaultyUpdateList, status)
    }
@@ -113,7 +118,7 @@ class UpdatesManagerImpl @Inject constructor(
        return Pair(nonFaultyUpdateList, status)
    }

    fun getApplicationCategoryPreference(): String {
    fun getApplicationCategoryPreference(): List<String> {
        return fusedAPIRepository.getApplicationCategoryPreference()
    }
}
Loading