Draft: feat: rewrite parental control feature enabling F-Droid's anti-features fetching from CleanAPK API
Description
This MR enables App Lounge to fetch NSFW rating for F-Droid app (via CleanAPK API) and verify its installation based on device's parental control setting. There are some other changes that are also part of this MR:
Introduction of new modules
-
InterceptorModule
andNetworkModule
are introduced to contain the relevant functionality. -
RetrofitModule
is renamed toRetrofitApiModule
to contain only the APIs needed for Retrofit.
parentalcontrol
directory
Moving classes into The /data/blockedApps
directory no longer holds the classes for parental control because of their difference in functionality. Instead, /data/parentalcontrol
directory contains the related classes.
Defining states for parental control
Parental control state from /e/OS is mapped into either Disabled
or AgeGroup
state in ParentalControlState
sealed class. AgeGroup
has corresponding values i.e. THREE
, SIX
, etc.
Defining states for app installation permission
App installation permission is also mapped into three states: Allowed
, Denied
and DeniedOnDataLoadError
. The last one prevents installation if App Lounge fails to load any required data before checking for parental control setting.
Unit tests
The GetAppInstallationPermissionUseCase
class has been covered with unit tests.
Miscellaneous
CleanApkRepository
gets a new method for fetching application details. It utilizes Kotlin's Result class and runCatching function to handle the network response.
Screenshots
Technical details
Tests
Tests have been performed to verify App Lounge's response to different parental control settings. Important to note that, CleanAPK is yet to publish the new changes in production. So, the tests have been performed against CleanAPK's dev endpoint. It's expected to contain the similar behaviour when deployed.
Issues
Issue: https://gitlab.e.foundation/e/os/backlog/-/issues/2112