diff --git a/app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt b/app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt index 9657199e1c0637b9c8e0ae0deb598e049d627c29..8f29b05690534647a83f25520b215ef1ff4ccfbf 100644 --- a/app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt +++ b/app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt @@ -109,8 +109,12 @@ class FusedAPIImpl @Inject constructor( return true } - fun getApplicationCategoryPreference(): String { - return preferenceManagerModule.preferredApplicationType() + fun getApplicationCategoryPreference(): List { + val prefs = mutableListOf() + 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( diff --git a/app/src/main/java/foundation/e/apps/api/fused/FusedAPIRepository.kt b/app/src/main/java/foundation/e/apps/api/fused/FusedAPIRepository.kt index 28000e6351b6dbbda18ec8edc08830fd0a1a08da..537b533c0c949137617f649f4cd91fd5a247151d 100644 --- a/app/src/main/java/foundation/e/apps/api/fused/FusedAPIRepository.kt +++ b/app/src/main/java/foundation/e/apps/api/fused/FusedAPIRepository.kt @@ -86,7 +86,7 @@ class FusedAPIRepository @Inject constructor(private val fusedAPIImpl: FusedAPII return fusedAPIImpl.isFusedHomesEmpty(fusedHomes) } - fun getApplicationCategoryPreference(): String { + fun getApplicationCategoryPreference(): List { return fusedAPIImpl.getApplicationCategoryPreference() } diff --git a/app/src/main/java/foundation/e/apps/home/HomeViewModel.kt b/app/src/main/java/foundation/e/apps/home/HomeViewModel.kt index d42e4dce0ab5f36682f81464d75bc36a2f9eb37d..dd24925e7b75fa208d72bbd0439663ce82e132bb 100644 --- a/app/src/main/java/foundation/e/apps/home/HomeViewModel.kt +++ b/app/src/main/java/foundation/e/apps/home/HomeViewModel.kt @@ -93,7 +93,7 @@ class HomeViewModel @Inject constructor( } } - fun getApplicationCategoryPreference(): String { + fun getApplicationCategoryPreference(): List { return fusedAPIRepository.getApplicationCategoryPreference() } diff --git a/app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt b/app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt index 12b98283daa134aa3614a73f1eb40ca6877c4489..d576b6ae8f8dab0346bf261632c75d73a502c0fd 100644 --- a/app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt +++ b/app/src/main/java/foundation/e/apps/updates/UpdatesViewModel.kt @@ -115,7 +115,7 @@ class UpdatesViewModel @Inject constructor( return false } - fun getApplicationCategoryPreference(): String { + fun getApplicationCategoryPreference(): List { return updatesManagerRepository.getApplicationCategoryPreference() } diff --git a/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerImpl.kt b/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerImpl.kt index 85c3dd009fdec4c97377296a9e05f51a5bf689f4..d80a5ded2020fbafde64e30d868f5126446e8cf9 100644 --- a/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerImpl.kt +++ b/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerImpl.kt @@ -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,18 +64,22 @@ class UpdatesManagerImpl @Inject constructor( } } - // Check for remaining apps from GPlay - val gPlayResult = fusedAPIRepository.getApplicationDetails( - pkgList, - authData, - Origin.GPLAY - ) - gPlayResult.first.forEach { - if (it.status == Status.UPDATABLE && it.filterLevel.isUnFiltered()) updateList.add(it) - } - gPlayResult.second.let { - if (it != ResultStatus.OK) { - status = it + if (getApplicationCategoryPreference().contains(APP_TYPE_ANY)) { + // Check for remaining apps from GPlay + val gPlayResult = fusedAPIRepository.getApplicationDetails( + pkgList, + authData, + Origin.GPLAY + ) + gPlayResult.first.forEach { + if (it.status == Status.UPDATABLE && it.filterLevel.isUnFiltered()) updateList.add( + it + ) + } + gPlayResult.second.let { + if (it != ResultStatus.OK) { + status = it + } } } } @@ -113,7 +118,7 @@ class UpdatesManagerImpl @Inject constructor( return Pair(nonFaultyUpdateList, status) } - fun getApplicationCategoryPreference(): String { + fun getApplicationCategoryPreference(): List { return fusedAPIRepository.getApplicationCategoryPreference() } } diff --git a/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt b/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt index ca69ff1043b871eb4ec006d296bcb32487733405..f15c8bde010a39aee058734088574a80b748bba8 100644 --- a/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt +++ b/app/src/main/java/foundation/e/apps/updates/manager/UpdatesManagerRepository.kt @@ -43,7 +43,7 @@ class UpdatesManagerRepository @Inject constructor( return updatesManagerImpl.getUpdatesOSS() } - fun getApplicationCategoryPreference(): String { + fun getApplicationCategoryPreference(): List { return updatesManagerImpl.getApplicationCategoryPreference() } }