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 bd95259361d53ad4eb9f6b0a479b7ccc0d424c91..210a4aa1199b004e2de40ee65647947477eeb268 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 + + 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) + } + } } private fun updateCategoryTitle(app: Application) { 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 22101b2c6a10eff0c42a9576276867344a6eeb94..35aecadfdc2d214a3c206c7101bd75089e2cfdb7 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 { 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 0000000000000000000000000000000000000000..c9a37159ebcc55acf1a2dc0f628f422274cf8779 --- /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 96ec06c1f3a50de7f8ac28f892ff122d7158f22d..5c42233a8aad059bab96be91c7e1f2956031ab19 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 d01d12f84f06766118ec092fdefe02f87b22c4c9..5d85e8da575f3578775611b58b8a465159ae6aa9 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. + +