Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Skip to content

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 and NetworkModule are introduced to contain the relevant functionality.
  • RetrofitModule is renamed to RetrofitApiModule to contain only the APIs needed for Retrofit.

Moving classes into parentalcontrol directory

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.

image

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

10 commandments of code reviews

👪 https://gitlab.e.foundation/internal/wiki/-/wikis/mobile-team/guidelines/Code-review

Edited by Fahim Masud Choudhury

Merge request reports

Loading