From 1fb52aaa6c0f6c888e3d3923e1be22ad68fa13c7 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Mon, 9 Oct 2023 10:57:55 +0600 Subject: [PATCH 1/7] initial fix for limited result --- .../e/apps/data/fused/FusedAPIRepository.kt | 42 ++++++++++++++++++- .../e/apps/data/fused/FusedApiImpl.kt | 3 +- .../data/gplay/GplayStoreRepositoryImpl.kt | 3 +- 3 files changed, 44 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/fused/FusedAPIRepository.kt b/app/src/main/java/foundation/e/apps/data/fused/FusedAPIRepository.kt index 00dd50683..6a3c50f2e 100644 --- a/app/src/main/java/foundation/e/apps/data/fused/FusedAPIRepository.kt +++ b/app/src/main/java/foundation/e/apps/data/fused/FusedAPIRepository.kt @@ -19,6 +19,8 @@ package foundation.e.apps.data.fused import androidx.lifecycle.LiveData +import androidx.lifecycle.map +import androidx.lifecycle.switchMap import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.AuthData import com.aurora.gplayapi.data.models.SearchBundle @@ -33,14 +35,44 @@ import foundation.e.apps.data.fused.data.FusedCategory import foundation.e.apps.data.fused.data.FusedHome import foundation.e.apps.data.fused.utils.CategoryType import foundation.e.apps.data.fusedDownload.models.FusedDownload +import foundation.e.apps.data.login.AuthObject +import foundation.e.apps.utils.eventBus.AppEvent +import foundation.e.apps.utils.eventBus.EventBus +import kotlinx.coroutines.MainScope +import kotlinx.coroutines.launch +import timber.log.Timber import javax.inject.Inject import javax.inject.Singleton @Singleton class FusedAPIRepository @Inject constructor(private val fusedAPIImpl: FusedApi) { + private var hasGplayLimitedResult: Boolean = false + suspend fun getHomeScreenData(authData: AuthData): LiveData>> { - return fusedAPIImpl.getHomeScreenData(authData) + return fusedAPIImpl.getHomeScreenData(authData).map { + if (!it.isSuccess()) { + return@map it + } + + val gplayHomes = it.data?.filter { fusedHome -> fusedHome.source.isEmpty() } + Timber.d("Gplayhome size: ${gplayHomes?.size}") + hasGplayLimitedResult = gplayHomes?.any { fusedHome -> fusedHome.list.size < 4 } == true + Timber.d("hasGplayLimitedResult: $hasGplayLimitedResult") + if (hasGplayLimitedResult) { + triggerInvalidAuthEvent() + } + + it + } + } + + private fun triggerInvalidAuthEvent() { + MainScope().launch { + EventBus.invokeEvent( + AppEvent.InvalidAuthEvent(AuthObject.GPlayAuth::class.java.simpleName) + ) + } } fun isHomesEmpty(fusedHomes: List): Boolean { @@ -119,7 +151,13 @@ class FusedAPIRepository @Inject constructor(private val fusedAPIImpl: FusedApi) query: String, nextPageSubBundle: Set? ): GplaySearchResult { - return fusedAPIImpl.getGplaySearchResult(query, nextPageSubBundle) + val gplaySearchResult = fusedAPIImpl.getGplaySearchResult(query, nextPageSubBundle) + val appList = gplaySearchResult.data?.first + if (hasGplayLimitedResult && appList.isNullOrEmpty()) { + triggerInvalidAuthEvent() + } + + return gplaySearchResult } suspend fun getAppsListBasedOnCategory( diff --git a/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt b/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt index 5aa83c320..0eef50f3b 100644 --- a/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt @@ -1165,7 +1165,7 @@ class FusedApiImpl @Inject constructor( } } - private suspend fun fetchGPlayHome(authData: AuthData): List { + private suspend fun fetchGPlayHome(authData: AuthData): List { val list = mutableListOf() val gplayHomeData = gplayRepository.getHomeScreenData() as Map> gplayHomeData.map { @@ -1176,6 +1176,7 @@ class FusedApiImpl @Inject constructor( } list.add(FusedHome(it.key, fusedApps)) } + Timber.d("===> $list") return list } diff --git a/app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt b/app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt index 383f8e7c6..123e6646c 100644 --- a/app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/gplay/GplayStoreRepositoryImpl.kt @@ -60,7 +60,8 @@ class GplayStoreRepositoryImpl @Inject constructor( val result = getTopApps(type, chart, authData) homeScreenData[it.key] = result } - + val firstAppList = homeScreenData[Chart.TOP_SELLING_FREE.toString()] + homeScreenData[Chart.TOP_SELLING_FREE.toString()] = firstAppList?.toMutableList()?.subList(0, 2) ?: mutableListOf() return homeScreenData } -- GitLab From 92e71c7e9cef59877e1eda5e3d5d18b1c19dc3b3 Mon Sep 17 00:00:00 2001 From: Hasib Prince Date: Fri, 13 Oct 2023 16:56:09 +0600 Subject: [PATCH 2/7] resolved conflict --- .../e/apps/data/fused/FusedApiImpl.kt | 40 ++++++++++++++++++- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt b/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt index 0eef50f3b..853b45df3 100644 --- a/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/fused/FusedApiImpl.kt @@ -62,13 +62,18 @@ import foundation.e.apps.data.fused.utils.CategoryUtils import foundation.e.apps.data.fusedDownload.models.FusedDownload import foundation.e.apps.data.gplay.GplayStoreRepository import foundation.e.apps.data.handleNetworkResult +import foundation.e.apps.data.login.AuthObject import foundation.e.apps.data.preference.PreferenceManagerModule import foundation.e.apps.install.pkg.PWAManagerModule import foundation.e.apps.install.pkg.PkgManagerModule import foundation.e.apps.ui.home.model.HomeChildFusedAppDiffUtil +import foundation.e.apps.utils.eventBus.AppEvent +import foundation.e.apps.utils.eventBus.EventBus import kotlinx.coroutines.Deferred +import kotlinx.coroutines.MainScope import kotlinx.coroutines.async import kotlinx.coroutines.coroutineScope +import kotlinx.coroutines.launch import retrofit2.Response import timber.log.Timber import javax.inject.Inject @@ -93,6 +98,8 @@ class FusedApiImpl @Inject constructor( private const val CATEGORY_TITLE_REPLACEABLE_CONJUNCTION = "&" private const val CATEGORY_OPEN_GAMES_ID = "game_open_games" private const val CATEGORY_OPEN_GAMES_TITLE = "Open games" + private const val THRESHOLD_LIMITED_RESULT_HOME_PAGE = 4 + private const val KEYWORD_TEST_SEARCH = "facebook" } /** @@ -1031,6 +1038,7 @@ class FusedApiImpl @Inject constructor( val fusedAppList = searchResults.first.map { app -> replaceWithFDroid(app) }.toMutableList() + hasLimitedResultForSearch(fusedAppList) if (searchResults.second.isNotEmpty()) { fusedAppList.add(FusedApp(isPlaceHolder = true)) @@ -1040,6 +1048,16 @@ class FusedApiImpl @Inject constructor( } } + private suspend fun hasLimitedResultForSearch(appList: List?) { + if (appList.isNullOrEmpty()) { + val searchResult = gplayRepository.getSearchResult(KEYWORD_TEST_SEARCH, null) + if (searchResult.first.isEmpty()) { + Timber.w("Limited result for search is found...") + triggerInvalidAuthEvent() + } + } + } + /* * This function will replace a GPlay app with F-Droid app if exists, * else will show the GPlay app itself. @@ -1177,14 +1195,32 @@ class FusedApiImpl @Inject constructor( list.add(FusedHome(it.key, fusedApps)) } - Timber.d("===> $list") + handleLimitedResultForHomePage(list) + Timber.d("HomePageData: $list") + return list } + private fun handleLimitedResultForHomePage(it: List) { + val gplayHomes = it.filter { fusedHome -> fusedHome.source.isEmpty() } + val hasGplayLimitedResult = gplayHomes.any { fusedHome -> fusedHome.list.size < THRESHOLD_LIMITED_RESULT_HOME_PAGE } + if (hasGplayLimitedResult) { + Timber.w("Limited result is found for homepage...") + triggerInvalidAuthEvent() + } + } + + private fun triggerInvalidAuthEvent() { + MainScope().launch { + EventBus.invokeEvent( + AppEvent.InvalidAuthEvent(AuthObject.GPlayAuth::class.java.simpleName) + ) + } + } + /* * FusedApp-related internal extensions and functions */ - private fun App.transformToFusedApp(): FusedApp { val app = FusedApp( _id = this.id.toString(), -- GitLab From 688825d9b0e6b6e3601604e81a9d8c021225297b Mon Sep 17 00:00:00 2001 From: F Wildermuth Date: Mon, 2 Oct 2023 08:59:52 +0000 Subject: [PATCH 3/7] Translated using Weblate (German) Currently translated at 99.4% (167 of 168 strings) Translation: /e//App Lounge Translate-URL: https://i18n.e.foundation/projects/e/app-lounge/de/ --- app/src/main/res/values-de/strings.xml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index bc8637159..aafa2cb17 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -166,4 +166,7 @@ \n\t• Micro-Targeting abzuschwächen \n\t• die Auswirkungen zu begrenzen, falls dieses Konto von Google eingeschränkt wird Bitte %1$s Speicherplatz auf diesem Gerät freimachen, damtit die neueste Aktualisierung installiert werden kann. + Aktualisierungen werden überprüft … + Das anonyme Konto, das von Ihnen genutzt wird, ist nicht verfügbar. Bitte erneuern (refresh) Sie die Sitzung, um ein neues anonymes Konto zu erhalten. + SITZUNG ERNEUERN \ No newline at end of file -- GitLab From 3eaa8a75936a8f5eff51a34f4ad3918fb21a0142 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sveinn=20=C3=AD=20Felli?= Date: Tue, 3 Oct 2023 10:35:37 +0000 Subject: [PATCH 4/7] Translated using Weblate (Icelandic) Currently translated at 100.0% (168 of 168 strings) Translation: /e//App Lounge Translate-URL: https://i18n.e.foundation/projects/e/app-lounge/is/ --- app/src/main/res/values-is/strings.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/res/values-is/strings.xml b/app/src/main/res/values-is/strings.xml index 58dda78da..f60f9e174 100644 --- a/app/src/main/res/values-is/strings.xml +++ b/app/src/main/res/values-is/strings.xml @@ -168,4 +168,6 @@ Með því að smella á \"%1$s\" mun opnast flipi í vafranum þínum mep heiti pakkans forútfylltu.<br /><br />Smelltu á \"Perform analysis\" til að hefja greiningu með Exodus.<br /><br />Þegar hnappurinn \"See the report\" birtist (tíminn sem það tekur fer eftir forritinu) geturðu lokað flipanum og snúið til baka í lýsingu forritsins á %2$s þar sem þú ættir að sjá gagnaleyndareinkunnina (Privacy Score). Stundum mistekst Exodus að greina forrit.<br /><br />ATH: það getur tekið allt að 10 mínútur fyrir einkunnina að birtast í lýsingunni á forritinu. ENDURLESA SETU Nafnlausi aðgangurinn sem þú ert að nota er ekki tiltækur. Endurlestu setuna til að fá annann. + Losaðu um %1$s pláss á símanum þínum til að fá nýjustu uppfærslur. + Athuga með uppfærslur... \ No newline at end of file -- GitLab From f369d67cac3afed77a1c6440944730829d3049c8 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 4 Oct 2023 13:20:54 +0000 Subject: [PATCH 5/7] Issue 1652 - Fix open source apps search --- .../foundation/e/apps/ui/search/SearchFragment.kt | 5 +++++ .../e/apps/ui/search/SearchViewModel.kt | 15 +++++++++++---- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt b/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt index a0b02883a..5e2a519ab 100644 --- a/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/search/SearchFragment.kt @@ -140,6 +140,11 @@ class SearchFragment : if (!requireContext().isNetworkAvailable()) { return } + + if (authObjects.value?.none { it is AuthObject.GPlayAuth } == true) { + return + } + searchViewModel.loadMore(searchText) } } diff --git a/app/src/main/java/foundation/e/apps/ui/search/SearchViewModel.kt b/app/src/main/java/foundation/e/apps/ui/search/SearchViewModel.kt index a2bc71080..dbf0b1ba9 100644 --- a/app/src/main/java/foundation/e/apps/ui/search/SearchViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/search/SearchViewModel.kt @@ -91,7 +91,7 @@ class SearchViewModel @Inject constructor( } successAuthList.find { it is AuthObject.CleanApk }?.run { - getSearchResults(query, AuthData("", ""), lifecycleOwner) + getSearchResults(query, null, lifecycleOwner) return@onLoadData } }, retryBlock) @@ -105,17 +105,20 @@ class SearchViewModel @Inject constructor( */ private fun getSearchResults( query: String, - authData: AuthData, + authData: AuthData?, lifecycleOwner: LifecycleOwner ) { viewModelScope.launch(Dispatchers.IO) { - val searchResultSupreme = fusedAPIRepository.getCleanApkSearchResults(query, authData) + val searchResultSupreme = fusedAPIRepository.getCleanApkSearchResults( + query, + authData ?: AuthData("", "") + ) searchResult.postValue(searchResultSupreme) if (!searchResultSupreme.isSuccess()) { val exception = - if (authData.aasToken.isNotBlank() || authData.authToken.isNotBlank()) { + if (authData != null) { GPlayException( searchResultSupreme.isTimeout(), searchResultSupreme.message.ifBlank { DATA_LOAD_ERROR } @@ -130,6 +133,10 @@ class SearchViewModel @Inject constructor( handleException(exception) } + if (authData == null) { + return@launch + } + nextSubBundle = null fetchGplayData(query) } -- GitLab From ab6e02e50ba44c23bff447031963d2ab15817c3e Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Thu, 5 Oct 2023 23:48:03 +0530 Subject: [PATCH 6/7] update version to 2.6.5 for 1.16-rc --- app/build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/build.gradle b/app/build.gradle index da7abac21..1a50799bb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -11,7 +11,7 @@ plugins { def versionMajor = 2 def versionMinor = 6 -def versionPatch = 4 +def versionPatch = 5 def getGitHash = { -> def stdOut = new ByteArrayOutputStream() -- GitLab From 37433c81b4de7dfca6cbcbdb15e4bcfe667da09d Mon Sep 17 00:00:00 2001 From: Kristian Nordin Date: Mon, 9 Oct 2023 19:58:41 +0000 Subject: [PATCH 7/7] Translated using Weblate (Swedish) Currently translated at 81.5% (137 of 168 strings) Translation: /e//App Lounge Translate-URL: https://i18n.e.foundation/projects/e/app-lounge/sv/ --- app/src/main/res/values-sv/strings.xml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/app/src/main/res/values-sv/strings.xml b/app/src/main/res/values-sv/strings.xml index cfc91ab0c..4c2e6cede 100644 --- a/app/src/main/res/values-sv/strings.xml +++ b/app/src/main/res/values-sv/strings.xml @@ -127,4 +127,8 @@ Integritetspoängen är automatiskt beräknad utifrån behörigheter och spårare som detekterats i applikationer. Det ger en fingervisning micro-spårar sina användare.<br /><br />Algoritmens källkod för beräkningar kan hittas <a href=%1$s>här</a>.<br /><br />Spårardetektering utförs med <a href=%2$s>Exodus Privacy tools</a>.<br /><br />Poäng av 10.<br /><br />Läs mer om hur Integritetspoäng beräknas, dess begränsningar och hur du kan skydda dig själv från microspårning <a href=%3$s>på denna sidan</a>. Uppdateringar På grund av ett tillfälligt fel kan inte alla dina appar uppdateras. Försök igen senare. + Söker efter uppdateringar ... + Topplista: Gratisappar + Topplista: Gratisspel + Topplista: Betalappar \ No newline at end of file -- GitLab