diff --git a/app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt b/app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt index b5daea5364d514d195c803bdd63283a40fdeaaec..3364511b078b858d73799e3cb7cd02ec44186476 100644 --- a/app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt +++ b/app/src/main/java/foundation/e/apps/data/application/ApplicationDataManager.kt @@ -62,6 +62,7 @@ class ApplicationDataManager @Inject constructor( application.package_name.isBlank() -> FilterLevel.UNKNOWN !application.isFree && application.price.isBlank() -> FilterLevel.UI application.origin == Origin.CLEANAPK -> FilterLevel.NONE + application.origin == Origin.GITLAB_RELEASES -> FilterLevel.NONE !isRestricted(application) -> FilterLevel.NONE authData == null -> FilterLevel.UNKNOWN // cannot determine for gplay app !isApplicationVisible(application) -> FilterLevel.DATA diff --git a/app/src/main/java/foundation/e/apps/data/application/data/Application.kt b/app/src/main/java/foundation/e/apps/data/application/data/Application.kt index 2ff78b9473eacf42ad59184d1062e3bd9c4622a4..0d8bd51844ed68b10a43f3734d140cdf02836456 100644 --- a/app/src/main/java/foundation/e/apps/data/application/data/Application.kt +++ b/app/src/main/java/foundation/e/apps/data/application/data/Application.kt @@ -110,11 +110,15 @@ data class Application( this.type = if (this.is_pwa) PWA else NATIVE } + // TODO: Make this logic separate from data layer (https://gitlab.e.foundation/e/os/backlog/-/issues/2371) fun updateSource(context: Context) { this.apply { - source = if (origin != Origin.CLEANAPK) "" - else if (is_pwa) context.getString(R.string.pwa) - else context.getString(R.string.open_source) + source = when { + origin == Origin.GITLAB_RELEASES -> context.getString(R.string.system_app) + origin == Origin.GPLAY -> "" + is_pwa -> context.getString(R.string.pwa) + else -> context.getString(R.string.open_source) + } } } } diff --git a/app/src/main/java/foundation/e/apps/data/application/downloadInfo/DownloadInfoApiImpl.kt b/app/src/main/java/foundation/e/apps/data/application/downloadInfo/DownloadInfoApiImpl.kt index 896510856ea5187641145002b685febf22a26717..a0e47ae3f5d83c9b5311c3e3ff99954eb70c2c30 100644 --- a/app/src/main/java/foundation/e/apps/data/application/downloadInfo/DownloadInfoApiImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/application/downloadInfo/DownloadInfoApiImpl.kt @@ -68,6 +68,10 @@ class DownloadInfoApiImpl @Inject constructor( Origin.GPLAY -> { updateDownloadInfoFromGplay(appInstall, list) } + + Origin.GITLAB_RELEASES -> { + // TODO + } } appInstall.downloadURLList = list diff --git a/app/src/main/java/foundation/e/apps/data/application/home/HomeApiImpl.kt b/app/src/main/java/foundation/e/apps/data/application/home/HomeApiImpl.kt index d8b91b1734f2fbd610a89a1e01b087ae39fa71b5..53a4024276f1a9cd564337967f7d6f1fecffd79b 100644 --- a/app/src/main/java/foundation/e/apps/data/application/home/HomeApiImpl.kt +++ b/app/src/main/java/foundation/e/apps/data/application/home/HomeApiImpl.kt @@ -120,6 +120,10 @@ class HomeApiImpl @Inject constructor( Source.PWA -> handleNetworkResult { handleCleanApkHomes(priorList, SearchApi.APP_TYPE_PWA) } + + Source.GITLAB_RELEASES -> { + ResultSupreme.Error(message = "Gitlab source not allowed") + } } setHomeErrorMessage(result.getResultStatus(), source) @@ -223,6 +227,7 @@ class HomeApiImpl @Inject constructor( if (apiStatus != ResultStatus.OK) { apiStatus.message = when (source) { Source.GPLAY -> ("GPlay home loading error\n" + apiStatus.message).trim() + Source.GITLAB_RELEASES -> ("Gitlab home not allowed\n" + apiStatus.message).trim() Source.OPEN -> ("Open Source home loading error\n" + apiStatus.message).trim() Source.PWA -> ("PWA home loading error\n" + apiStatus.message).trim() } diff --git a/app/src/main/java/foundation/e/apps/data/enums/Origin.kt b/app/src/main/java/foundation/e/apps/data/enums/Origin.kt index b8bd98c8338b754b8ea67e332ce26bc47e45ea28..d5305b23de0f1ff6debf045272a22a9a3c6e8ab3 100644 --- a/app/src/main/java/foundation/e/apps/data/enums/Origin.kt +++ b/app/src/main/java/foundation/e/apps/data/enums/Origin.kt @@ -20,5 +20,6 @@ package foundation.e.apps.data.enums enum class Origin { CLEANAPK, - GPLAY + GPLAY, + GITLAB_RELEASES, } diff --git a/app/src/main/java/foundation/e/apps/data/enums/Source.kt b/app/src/main/java/foundation/e/apps/data/enums/Source.kt index 86fd9c631eb93a798ce6b160b691f8b2f7418ef0..fdecbc5ee2b5b4d073dc1edd29ff82e1b4a1849a 100644 --- a/app/src/main/java/foundation/e/apps/data/enums/Source.kt +++ b/app/src/main/java/foundation/e/apps/data/enums/Source.kt @@ -19,6 +19,7 @@ package foundation.e.apps.data.enums enum class Source { GPLAY, + GITLAB_RELEASES, OPEN, PWA; @@ -27,6 +28,7 @@ enum class Source { return when (source) { "Open Source" -> OPEN "PWA" -> PWA + "GITLAB_RELEASES" -> GITLAB_RELEASES else -> GPLAY } } diff --git a/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt b/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt index 994289f21415a5960a18b8b0b4fe77b45d1f1ba7..1370ad1cf2fb16de51cca9555af983ad644ee922 100644 --- a/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt +++ b/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt @@ -56,6 +56,10 @@ class ValidateAppAgeLimitUseCase @Inject constructor( data = ContentRatingValidity(true) ) + isGitlabApp(app) -> ResultSupreme.Success( + data = ContentRatingValidity(true) + ) + isKnownNsfwApp(app) -> ResultSupreme.Success(data = ContentRatingValidity(false)) isCleanApkApp(app) -> ResultSupreme.Success( data = ContentRatingValidity(isValid = !isNsfwAppByCleanApkApi(app)) @@ -70,6 +74,10 @@ class ValidateAppAgeLimitUseCase @Inject constructor( } } + private fun isGitlabApp(app: AppInstall): Boolean { + return app.origin == Origin.GITLAB_RELEASES + } + private fun isCleanApkApp(app: AppInstall): Boolean { return app.id.isNotBlank() && app.origin == Origin.CLEANAPK diff --git a/app/src/main/java/foundation/e/apps/ui/application/model/ApplicationScreenshotsRVAdapter.kt b/app/src/main/java/foundation/e/apps/ui/application/model/ApplicationScreenshotsRVAdapter.kt index 9fefd43d0ea72d6622cd0605f48eca66ab751214..7fa122efba5dbda14212c3740f97415e30ba9967 100644 --- a/app/src/main/java/foundation/e/apps/ui/application/model/ApplicationScreenshotsRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/ui/application/model/ApplicationScreenshotsRVAdapter.kt @@ -58,6 +58,9 @@ class ApplicationScreenshotsRVAdapter( Origin.GPLAY -> { imageView.load(oldList[position]) } + Origin.GITLAB_RELEASES -> { + // no operation + } } imageView.setOnClickListener { val action = diff --git a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt index 43cd6685181d946d211d9f8d86ecc6fe5a2b9280..40951778ec96d63c0161ad8347e3f9defa86dac9 100644 --- a/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt +++ b/app/src/main/java/foundation/e/apps/ui/applicationlist/ApplicationListRVAdapter.kt @@ -175,6 +175,9 @@ class ApplicationListRVAdapter( placeholder(shimmerDrawable) } } + Origin.GITLAB_RELEASES -> { + // TODO + } else -> Timber.wtf("${searchApp.package_name} is from an unknown origin") } } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 85f7f2bb8b342ba1428f6fb71f66d6f9c5cb4007..993dcea40961870a935c2ddf8d6a04b3c05ea0bf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -120,6 +120,7 @@ Open Source apps Some proprietary apps may also have an Open Source version. Whenever this happens App Lounge shows the Open Source version only, in order to avoid duplicates. Downloading… + System app Additional file for %s Having troubles? https://doc.e.foundation/support-topics/app_lounge_troubleshooting