From 0b2b07b86c37890f40e1e22630703b5f7f2d927e Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 18 Jun 2024 19:19:26 +0530 Subject: [PATCH 1/4] resources --- .../main/res/drawable/ic_visibility_off.xml | 27 ++++++++++ .../res/layout/fragment_application_title.xml | 49 ++++++++++++++++--- app/src/main/res/values/strings.xml | 10 +++- 3 files changed, 78 insertions(+), 8 deletions(-) create mode 100644 app/src/main/res/drawable/ic_visibility_off.xml diff --git a/app/src/main/res/drawable/ic_visibility_off.xml b/app/src/main/res/drawable/ic_visibility_off.xml new file mode 100644 index 000000000..c9a37159e --- /dev/null +++ b/app/src/main/res/drawable/ic_visibility_off.xml @@ -0,0 +1,27 @@ + + + + + diff --git a/app/src/main/res/layout/fragment_application_title.xml b/app/src/main/res/layout/fragment_application_title.xml index 96ec06c1f..5c42233a8 100644 --- a/app/src/main/res/layout/fragment_application_title.xml +++ b/app/src/main/res/layout/fragment_application_title.xml @@ -46,7 +46,8 @@ android:layout_alignParentStart="true" android:layout_centerVertical="true" android:contentDescription="@string/app_icon" - android:scaleType="fitXY" /> + android:scaleType="fitXY" + tools:src="@tools:sample/avatars" /> + android:textSize="22sp" + tools:text="@tools:sample/lorem" /> + android:textSize="16sp" + tools:text="@tools:sample/lorem" /> + + + + + + + + + tools:text="Open Source" + tools:visibility="visible" /> + tools:text="Racing" + tools:visibility="visible" /> - \ No newline at end of file + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index d01d12f84..5d85e8da5 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -125,8 +125,9 @@ https://doc.e.foundation/support-topics/app_lounge_troubleshooting Share [%1$s] Restricted App - You are too young to be able to install %1$s. Please check with your parent your age group is correct or disable Parental Control to be able to install it. + You are too young to be able to install %1$s. Please check with your parent your age group is correct or disable parental control to be able to install it. + This app may contain inappropriate content. Update All @@ -226,4 +227,9 @@ Split Install channel Sign in Ignore - \ No newline at end of file + + + Content Warning + The app may contain nudity, profanity, slurs, violence, intense sexuality, political incorrectness, or other potentially disturbing subject matter. This is especially relevant in environments like workplaces, schools, religious and family settings. + + -- GitLab From 5b6b4b708366e5accfc0a43834e6e6cb147617ae Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Tue, 18 Jun 2024 19:22:44 +0530 Subject: [PATCH 2/4] show NSFW warning --- .../workmanager/AppInstallProcessor.kt | 1 + .../ui/application/ApplicationFragment.kt | 23 +++++++++++++++++++ 2 files changed, 24 insertions(+) diff --git a/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt b/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt index 77fbf8b44..afc4717b9 100644 --- a/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +++ b/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt @@ -95,6 +95,7 @@ class AppInstallProcessor @Inject constructor( application.originalSize ).also { it.contentRating = application.contentRating + it.antiFeatures = application.antiFeatures } if (appInstall.type == Type.PWA) { diff --git a/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt index bd9525936..41d52bd50 100644 --- a/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt @@ -65,6 +65,7 @@ import foundation.e.apps.data.login.AuthObject import foundation.e.apps.data.login.exceptions.GPlayLoginException import foundation.e.apps.databinding.FragmentApplicationBinding import foundation.e.apps.di.CommonUtilsModule.LIST_OF_NULL +import foundation.e.apps.domain.ValidateAppAgeLimitUseCase.Companion.KEY_ANTI_FEATURES_NSFW import foundation.e.apps.install.download.data.DownloadProgress import foundation.e.apps.install.pkg.AppLoungePackageManager import foundation.e.apps.install.pkg.PWAManager @@ -433,6 +434,28 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { appIcon.load(it.icon_image_path) } } + + updateAntiFeaturesUi(it) + } + + private fun updateAntiFeaturesUi(app: Application) { + val isNsfwApp = + app.antiFeatures.find { antiFeature -> antiFeature.containsKey(KEY_ANTI_FEATURES_NSFW) } != null + + if (isNsfwApp) { + with(binding.titleInclude) { + antiFeatureInfoLayout.apply { + isVisible = true + setOnClickListener { + ApplicationDialogFragment( + title = getString(R.string.nsfw_dialog_title), + message = getString(R.string.nsfw_dialog_message), + drawableResId = R.drawable.ic_visibility_off + ).show(childFragmentManager, TAG) + } + } + } + } } private fun updateCategoryTitle(app: Application) { -- GitLab From f5514c33719ab4a7f06bf48a60881aac2f0f8257 Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 19 Jun 2024 16:20:05 +0530 Subject: [PATCH 3/4] remove antifeatures from AppInstall (formerly FusedDownload) --- .../foundation/e/apps/install/workmanager/AppInstallProcessor.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt b/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt index afc4717b9..77fbf8b44 100644 --- a/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt +++ b/app/src/main/java/foundation/e/apps/install/workmanager/AppInstallProcessor.kt @@ -95,7 +95,6 @@ class AppInstallProcessor @Inject constructor( application.originalSize ).also { it.contentRating = application.contentRating - it.antiFeatures = application.antiFeatures } if (appInstall.type == Type.PWA) { -- GitLab From 4684ad851eba4f84542756c5773387200e36c04a Mon Sep 17 00:00:00 2001 From: Sayantan Roychowdhury Date: Wed, 19 Jun 2024 19:05:01 +0530 Subject: [PATCH 4/4] fix NSFW badge not appearing if cleanapk does not have antifeatures --- .../ui/application/ApplicationFragment.kt | 24 +++++++++---------- .../ui/application/ApplicationViewModel.kt | 6 +++++ 2 files changed, 18 insertions(+), 12 deletions(-) diff --git a/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt b/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt index 41d52bd50..210a4aa11 100644 --- a/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt +++ b/app/src/main/java/foundation/e/apps/ui/application/ApplicationFragment.kt @@ -442,18 +442,18 @@ class ApplicationFragment : TimeoutFragment(R.layout.fragment_application) { val isNsfwApp = app.antiFeatures.find { antiFeature -> antiFeature.containsKey(KEY_ANTI_FEATURES_NSFW) } != null - if (isNsfwApp) { - with(binding.titleInclude) { - antiFeatureInfoLayout.apply { - isVisible = true - setOnClickListener { - ApplicationDialogFragment( - title = getString(R.string.nsfw_dialog_title), - message = getString(R.string.nsfw_dialog_message), - drawableResId = R.drawable.ic_visibility_off - ).show(childFragmentManager, TAG) - } - } + val isKnownNsfwApp = applicationViewModel.isKnownNsfwApp(app) + + if (!isNsfwApp && !isKnownNsfwApp) return + + binding.titleInclude.antiFeatureInfoLayout.apply { + isVisible = true + setOnClickListener { + ApplicationDialogFragment( + title = getString(R.string.nsfw_dialog_title), + message = getString(R.string.nsfw_dialog_message), + drawableResId = R.drawable.ic_visibility_off + ).show(childFragmentManager, TAG) } } } diff --git a/app/src/main/java/foundation/e/apps/ui/application/ApplicationViewModel.kt b/app/src/main/java/foundation/e/apps/ui/application/ApplicationViewModel.kt index 22101b2c6..35aecadfd 100644 --- a/app/src/main/java/foundation/e/apps/ui/application/ApplicationViewModel.kt +++ b/app/src/main/java/foundation/e/apps/ui/application/ApplicationViewModel.kt @@ -28,6 +28,7 @@ import foundation.e.apps.R import foundation.e.apps.data.application.ApplicationRepository import foundation.e.apps.data.application.data.Application import foundation.e.apps.data.application.data.shareUri +import foundation.e.apps.data.blockedApps.ContentRatingsRepository import foundation.e.apps.data.enums.Origin import foundation.e.apps.data.enums.ResultStatus import foundation.e.apps.data.enums.Status @@ -55,6 +56,7 @@ class ApplicationViewModel @Inject constructor( private val applicationRepository: ApplicationRepository, private val playStoreRepository: PlayStoreRepository, private val appManagerWrapper: AppManagerWrapper, + private val contentRatingsRepository: ContentRatingsRepository, ) : LoadingViewModel() { val applicationLiveData: MutableLiveData> = MutableLiveData() @@ -235,6 +237,10 @@ class ApplicationViewModel @Inject constructor( } fun isOpenSourceSelected() = applicationRepository.isOpenSourceSelected() + + fun isKnownNsfwApp(app: Application): Boolean { + return app.package_name in contentRatingsRepository.fDroidNSFWApps + } } sealed class ShareButtonVisibilityState { -- GitLab