Loading app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ dependencies { api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.11-alpha' implementation "foundation.e:gplayapi:3.2.10-2" implementation "foundation.e:gplayapi:3.2.10-3" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' Loading app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt +8 −2 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -14,6 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.data.playstore Loading @@ -21,6 +21,7 @@ package foundation.e.apps.data.playstore import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import foundation.e.apps.data.StoreRepository Loading @@ -43,4 +44,9 @@ interface PlayStoreRepository : StoreRepository { versionCode: Int, offerType: Int ): List<File> suspend fun updateContentRatingWithId( appPackage: String, contentRating: ContentRating ): ContentRating } app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt +25 −14 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -14,6 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.data.playstore Loading @@ -23,6 +23,7 @@ import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import com.aurora.gplayapi.data.models.StreamCluster Loading @@ -30,14 +31,15 @@ import com.aurora.gplayapi.helpers.AppDetailsHelper import com.aurora.gplayapi.helpers.CategoryAppsHelper import com.aurora.gplayapi.helpers.CategoryHelper import com.aurora.gplayapi.helpers.Chart import com.aurora.gplayapi.helpers.ContentRatingHelper import com.aurora.gplayapi.helpers.PurchaseHelper 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.application.utils.CategoryType import foundation.e.apps.data.playstore.utils.GPlayHttpClient import foundation.e.apps.data.login.AuthenticatorRepository import foundation.e.apps.data.playstore.utils.GPlayHttpClient import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import timber.log.Timber Loading Loading @@ -78,8 +80,7 @@ class PlayStoreRepositoryImpl @Inject constructor( subBundle: MutableSet<SearchBundle.SubBundle>? ): Pair<List<App>, MutableSet<SearchBundle.SubBundle>> { var authData = authenticatorRepository.gplayAuth!! val searchHelper = SearchHelper(authData).using(gPlayHttpClient) val searchHelper = SearchHelper(authData).using(gPlayHttpClient) Timber.d("Fetching search result for $query, subBundle: $subBundle") Loading Loading @@ -115,8 +116,7 @@ class PlayStoreRepositoryImpl @Inject constructor( override suspend fun getAppsByCategory(category: String, pageUrl: String?): StreamCluster { val authData = authenticatorRepository.gplayAuth!! val subCategoryHelper = CategoryAppsHelper(authData).using(gPlayHttpClient) val subCategoryHelper = CategoryAppsHelper(authData).using(gPlayHttpClient) if (!pageUrl.isNullOrEmpty()) { return subCategoryHelper.next(pageUrl) Loading Loading @@ -163,7 +163,8 @@ class PlayStoreRepositoryImpl @Inject constructor( } private fun getCategoryType(type: CategoryType): Category.Type { return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME } private suspend fun getTopApps( Loading Loading @@ -207,14 +208,24 @@ class PlayStoreRepositoryImpl @Inject constructor( withContext(Dispatchers.IO) { val purchaseHelper = PurchaseHelper(authData).using(gPlayHttpClient) downloadData.addAll( purchaseHelper.getOnDemandModule( packageName, moduleName, versionCode, offerType ) purchaseHelper.getOnDemandModule(packageName, moduleName, versionCode, offerType) ) } return downloadData } override suspend fun updateContentRatingWithId( appPackage: String, contentRating: ContentRating ): ContentRating { val authData = authenticatorRepository.gplayAuth!! val contentRatingHelper = ContentRatingHelper(authData) return withContext(Dispatchers.IO) { contentRatingHelper.updateContentRatingWithId( appPackage, contentRating ) } } } app/src/main/java/foundation/e/apps/di/RepositoryModule.kt +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.di import dagger.Binds Loading @@ -12,6 +30,8 @@ import foundation.e.apps.data.fdroid.FdroidRepository import foundation.e.apps.data.fdroid.IFdroidRepository import foundation.e.apps.data.fusedDownload.FusedManagerImpl import foundation.e.apps.data.fusedDownload.IFusedManager import foundation.e.apps.data.playstore.PlayStoreRepository import foundation.e.apps.data.playstore.PlayStoreRepositoryImpl import javax.inject.Singleton @Module Loading @@ -32,4 +52,8 @@ interface RepositoryModule { @Singleton @Binds fun getPrivacyScoreRepository(privacyScoreRepositoryImpl: PrivacyScoreRepositoryImpl): PrivacyScoreRepository @Singleton @Binds fun getPlayStoreRepository(playStoreRepository: PlayStoreRepositoryImpl): PlayStoreRepository } app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +12 −13 Original line number Diff line number Diff line Loading @@ -494,23 +494,13 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { private fun collectAppContentRatingState() { lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.RESUMED) { applicationViewModel.appContentRating.collectLatest(::updateContentRatingUi) applicationViewModel.appContentRatingState .collectLatest(::updateContentRatingUi) } } } private fun updateContentRatingUi(contentRating: ContentRating) { fun loadContentRating(contentRating: ContentRating) { lifecycleScope.launch { val drawable = loadContentRatingDrawable(contentRating.artwork.url) displayRating(contentRating, drawable) } } fun hideContentRating() { binding.ratingsInclude.appContentRatingLayout.visibility = View.GONE } private suspend fun updateContentRatingUi(contentRating: ContentRating) { if (contentRating.isValid()) { loadContentRating(contentRating) } else { Loading @@ -518,6 +508,15 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { } } private suspend fun loadContentRating(contentRating: ContentRating) { val drawable = loadContentRatingDrawable(contentRating.artwork.url) displayRating(contentRating, drawable) } private fun hideContentRating() { binding.ratingsInclude.appContentRatingLayout.visibility = View.GONE } private fun displayRating(contentRating: ContentRating, drawable: Drawable?) { binding.ratingsInclude.apply { appContentRatingTitle.text = contentRating.title Loading Loading
app/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -153,7 +153,7 @@ dependencies { api files('libs/splitinstall-lib.jar') implementation 'foundation.e.lib:telemetry:0.0.11-alpha' implementation "foundation.e:gplayapi:3.2.10-2" implementation "foundation.e:gplayapi:3.2.10-3" implementation 'androidx.core:core-ktx:1.9.0' implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.fragment:fragment-ktx:1.5.6' Loading
app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepository.kt +8 −2 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -14,6 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.data.playstore Loading @@ -21,6 +21,7 @@ package foundation.e.apps.data.playstore import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import foundation.e.apps.data.StoreRepository Loading @@ -43,4 +44,9 @@ interface PlayStoreRepository : StoreRepository { versionCode: Int, offerType: Int ): List<File> suspend fun updateContentRatingWithId( appPackage: String, contentRating: ContentRating ): ContentRating }
app/src/main/java/foundation/e/apps/data/playstore/PlayStoreRepositoryImpl.kt +25 −14 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2023 * Apps Quickly and easily install Android apps onto your device! * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -14,6 +13,7 @@ * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.data.playstore Loading @@ -23,6 +23,7 @@ import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.Category import com.aurora.gplayapi.data.models.ContentRating import com.aurora.gplayapi.data.models.File import com.aurora.gplayapi.data.models.SearchBundle import com.aurora.gplayapi.data.models.StreamCluster Loading @@ -30,14 +31,15 @@ import com.aurora.gplayapi.helpers.AppDetailsHelper import com.aurora.gplayapi.helpers.CategoryAppsHelper import com.aurora.gplayapi.helpers.CategoryHelper import com.aurora.gplayapi.helpers.Chart import com.aurora.gplayapi.helpers.ContentRatingHelper import com.aurora.gplayapi.helpers.PurchaseHelper 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.application.utils.CategoryType import foundation.e.apps.data.playstore.utils.GPlayHttpClient import foundation.e.apps.data.login.AuthenticatorRepository import foundation.e.apps.data.playstore.utils.GPlayHttpClient import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.withContext import timber.log.Timber Loading Loading @@ -78,8 +80,7 @@ class PlayStoreRepositoryImpl @Inject constructor( subBundle: MutableSet<SearchBundle.SubBundle>? ): Pair<List<App>, MutableSet<SearchBundle.SubBundle>> { var authData = authenticatorRepository.gplayAuth!! val searchHelper = SearchHelper(authData).using(gPlayHttpClient) val searchHelper = SearchHelper(authData).using(gPlayHttpClient) Timber.d("Fetching search result for $query, subBundle: $subBundle") Loading Loading @@ -115,8 +116,7 @@ class PlayStoreRepositoryImpl @Inject constructor( override suspend fun getAppsByCategory(category: String, pageUrl: String?): StreamCluster { val authData = authenticatorRepository.gplayAuth!! val subCategoryHelper = CategoryAppsHelper(authData).using(gPlayHttpClient) val subCategoryHelper = CategoryAppsHelper(authData).using(gPlayHttpClient) if (!pageUrl.isNullOrEmpty()) { return subCategoryHelper.next(pageUrl) Loading Loading @@ -163,7 +163,8 @@ class PlayStoreRepositoryImpl @Inject constructor( } private fun getCategoryType(type: CategoryType): Category.Type { return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME return if (type == CategoryType.APPLICATION) Category.Type.APPLICATION else Category.Type.GAME } private suspend fun getTopApps( Loading Loading @@ -207,14 +208,24 @@ class PlayStoreRepositoryImpl @Inject constructor( withContext(Dispatchers.IO) { val purchaseHelper = PurchaseHelper(authData).using(gPlayHttpClient) downloadData.addAll( purchaseHelper.getOnDemandModule( packageName, moduleName, versionCode, offerType ) purchaseHelper.getOnDemandModule(packageName, moduleName, versionCode, offerType) ) } return downloadData } override suspend fun updateContentRatingWithId( appPackage: String, contentRating: ContentRating ): ContentRating { val authData = authenticatorRepository.gplayAuth!! val contentRatingHelper = ContentRatingHelper(authData) return withContext(Dispatchers.IO) { contentRatingHelper.updateContentRatingWithId( appPackage, contentRating ) } } }
app/src/main/java/foundation/e/apps/di/RepositoryModule.kt +24 −0 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package foundation.e.apps.di import dagger.Binds Loading @@ -12,6 +30,8 @@ import foundation.e.apps.data.fdroid.FdroidRepository import foundation.e.apps.data.fdroid.IFdroidRepository import foundation.e.apps.data.fusedDownload.FusedManagerImpl import foundation.e.apps.data.fusedDownload.IFusedManager import foundation.e.apps.data.playstore.PlayStoreRepository import foundation.e.apps.data.playstore.PlayStoreRepositoryImpl import javax.inject.Singleton @Module Loading @@ -32,4 +52,8 @@ interface RepositoryModule { @Singleton @Binds fun getPrivacyScoreRepository(privacyScoreRepositoryImpl: PrivacyScoreRepositoryImpl): PrivacyScoreRepository @Singleton @Binds fun getPlayStoreRepository(playStoreRepository: PlayStoreRepositoryImpl): PlayStoreRepository }
app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +12 −13 Original line number Diff line number Diff line Loading @@ -494,23 +494,13 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { private fun collectAppContentRatingState() { lifecycleScope.launch { repeatOnLifecycle(Lifecycle.State.RESUMED) { applicationViewModel.appContentRating.collectLatest(::updateContentRatingUi) applicationViewModel.appContentRatingState .collectLatest(::updateContentRatingUi) } } } private fun updateContentRatingUi(contentRating: ContentRating) { fun loadContentRating(contentRating: ContentRating) { lifecycleScope.launch { val drawable = loadContentRatingDrawable(contentRating.artwork.url) displayRating(contentRating, drawable) } } fun hideContentRating() { binding.ratingsInclude.appContentRatingLayout.visibility = View.GONE } private suspend fun updateContentRatingUi(contentRating: ContentRating) { if (contentRating.isValid()) { loadContentRating(contentRating) } else { Loading @@ -518,6 +508,15 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { } } private suspend fun loadContentRating(contentRating: ContentRating) { val drawable = loadContentRatingDrawable(contentRating.artwork.url) displayRating(contentRating, drawable) } private fun hideContentRating() { binding.ratingsInclude.appContentRatingLayout.visibility = View.GONE } private fun displayRating(contentRating: ContentRating, drawable: Drawable?) { binding.ratingsInclude.apply { appContentRatingTitle.text = contentRating.title Loading