From 3495d3d9e20e61f88d23253136784521c048fcdb Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Wed, 4 May 2022 23:24:33 +0530 Subject: [PATCH 1/2] App lounge: (issue_5174) Filter out restricted apps from updates list --- .../e/apps/api/fused/FusedAPIImpl.kt | 29 ++++++++++++++++--- 1 file changed, 25 insertions(+), 4 deletions(-) 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 15d77d99b..6a49d1dcc 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 @@ -20,6 +20,8 @@ package foundation.e.apps.api.fused import android.content.Context import android.text.format.Formatter +import android.util.Log +import com.aurora.gplayapi.Constants import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App import com.aurora.gplayapi.data.models.Artwork @@ -257,13 +259,32 @@ class FusedAPIImpl @Inject constructor( pkgList } else { gPlayAPIRepository.getAppDetails(packageNameList, authData).map { app -> - app.transformToFusedApp() + /* + * Some apps are restricted to locations. Example "com.skype.m2". + * For restricted apps, check if it is possible to get their specific app info. + * + * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5174 + */ + if (app.restriction != Constants.Restriction.NOT_RESTRICTED) { + try { + Log.d(TAG, "Restricted app: ${app.packageName}, restriction: ${app.restriction}") + gPlayAPIRepository.getAppDetails(app.packageName, authData) + ?.transformToFusedApp() ?: FusedApp() + } catch (e: Exception) { + Log.d(TAG, "Failed to get info for restricted app: ${app.packageName}") + FusedApp() + } + } else { + app.transformToFusedApp() + } } } response.forEach { - it.updateStatus() - it.updateType() - list.add(it) + if (it.package_name.isNotBlank()) { + it.updateStatus() + it.updateType() + list.add(it) + } } return list } -- GitLab From e2f113892fe7c187a2df892f44a3b5e9e660fe2e Mon Sep 17 00:00:00 2001 From: SayantanRC Date: Mon, 9 May 2022 16:56:53 +0530 Subject: [PATCH 2/2] App lounge: (issue_5174) remove log --- app/src/main/java/foundation/e/apps/api/fused/FusedAPIImpl.kt | 3 --- 1 file changed, 3 deletions(-) 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 6a49d1dcc..4fea6e1fd 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 @@ -20,7 +20,6 @@ package foundation.e.apps.api.fused import android.content.Context import android.text.format.Formatter -import android.util.Log import com.aurora.gplayapi.Constants import com.aurora.gplayapi.SearchSuggestEntry import com.aurora.gplayapi.data.models.App @@ -267,11 +266,9 @@ class FusedAPIImpl @Inject constructor( */ if (app.restriction != Constants.Restriction.NOT_RESTRICTED) { try { - Log.d(TAG, "Restricted app: ${app.packageName}, restriction: ${app.restriction}") gPlayAPIRepository.getAppDetails(app.packageName, authData) ?.transformToFusedApp() ?: FusedApp() } catch (e: Exception) { - Log.d(TAG, "Failed to get info for restricted app: ${app.packageName}") FusedApp() } } else { -- GitLab