Loading app/src/main/java/foundation/e/apps/data/parentalcontrol/ParentalControlRepository.kt +6 −11 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * Copyright (C) 2025 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -19,10 +19,11 @@ package foundation.e.apps.data.parentalcontrol import android.content.Context import androidx.core.net.toUri import dagger.hilt.android.qualifiers.ApplicationContext import org.e.parentalcontrol.data.model.TypeAppManagement import javax.inject.Inject import javax.inject.Singleton import androidx.core.net.toUri @Singleton class ParentalControlRepository @Inject constructor( Loading Loading @@ -51,18 +52,18 @@ class ParentalControlRepository @Inject constructor( return Age.PARENTAL_CONTROL_DISABLED } fun getSelectedProtectionMode(): ProtectionMode { fun getSelectedTypeAppManagement(): TypeAppManagement { val uri = URI_PARENTAL_CONTROL_INSTALL_TYPE_APP_MANAGEMENT.toUri() val cursor = context.contentResolver.query(uri, null, null, null, null) cursor?.use { if (it.moveToFirst()) { val protectionMode = it.getInt(it.getColumnIndexOrThrow("protectionmode")) return ProtectionMode.entries[protectionMode] return TypeAppManagement.entries[protectionMode] } } return ProtectionMode.DISABLED_MODE return TypeAppManagement.DISABLED_MODE } } Loading @@ -74,9 +75,3 @@ enum class Age { SEVENTEEN, PARENTAL_CONTROL_DISABLED } enum class ProtectionMode { REGULAR_MODE, REQUEST_PIN_MODE, DISABLED_MODE } app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt +6 −6 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * Copyright (C) 2025 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading Loading @@ -29,11 +29,11 @@ import foundation.e.apps.data.parentalcontrol.Age import foundation.e.apps.data.parentalcontrol.ContentRatingDao import foundation.e.apps.data.parentalcontrol.ParentalControlRepository import foundation.e.apps.data.parentalcontrol.ParentalControlRepository.Companion.KEY_PARENTAL_GUIDANCE import foundation.e.apps.data.parentalcontrol.ProtectionMode import foundation.e.apps.data.parentalcontrol.fdroid.FDroidAntiFeatureRepository import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingGroup import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingRepository import foundation.e.apps.domain.model.ContentRatingValidity import org.e.parentalcontrol.data.model.TypeAppManagement import timber.log.Timber import javax.inject.Inject Loading @@ -53,8 +53,8 @@ class ValidateAppAgeLimitUseCase @Inject constructor( private val ageGroup: Age get() = parentalControlRepository.getSelectedAgeGroup() private val protectionMode: ProtectionMode get() = parentalControlRepository.getSelectedProtectionMode() private val typeAppManagement: TypeAppManagement get() = parentalControlRepository.getSelectedTypeAppManagement() suspend operator fun invoke(app: AppInstall): ResultSupreme<ContentRatingValidity> { Loading Loading @@ -123,7 +123,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor( ageGroup: Age, app: AppInstall ): ResultSupreme<ContentRatingValidity> { if (protectionMode == ProtectionMode.REGULAR_MODE) { if (typeAppManagement == TypeAppManagement.CONTENT_RATING) { val allowedContentRating = gPlayContentRatingRepository.contentRatingGroups.find { it.id == ageGroup.toString() } Loading Loading @@ -181,7 +181,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor( } private suspend fun isParentalGuidance(app: AppInstall): Boolean { if (protectionMode == ProtectionMode.REGULAR_MODE) { if (typeAppManagement == TypeAppManagement.CONTENT_RATING) { val fetchedContentRating = gPlayContentRatingRepository.getEnglishContentRating(app.packageName) return fetchedContentRating?.id == KEY_PARENTAL_GUIDANCE Loading parental-control-data/README.md 0 → 100644 +18 −0 Original line number Diff line number Diff line # App Lounge library This document describes the library used for sharing information between applications: - AppLounge - ParentalControl # Versions ## 1.0.0 Initial version : ParentalControlContract ## 1.1.0 TypeAppManagement: - CONTENT_RATING Legacy mode validation based on age - SECURITY_CODE Security code request by the Parental Controls application - DISABLED_MODE No restriction No newline at end of file parental-control-data/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ publishing { jar(MavenPublication) { groupId = 'foundation.e.apps' artifactId = 'ParentalControlData' version = '1.0.0' version = '1.1.0' artifact("$buildDir/libs/${project.name}.jar") Loading parental-control-data/src/main/java/org/e/parentalcontrol/data/model/TypeAppManagement.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2025 * Apps Quickly and easily install Android apps onto your device! * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package org.e.parentalcontrol.data.model enum class TypeAppManagement { CONTENT_RATING, // Legacy mode validation based on age SECURITY_CODE, // Security code request by the Parental Controls application DISABLED_MODE // No restriction } No newline at end of file Loading
app/src/main/java/foundation/e/apps/data/parentalcontrol/ParentalControlRepository.kt +6 −11 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * Copyright (C) 2025 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading @@ -19,10 +19,11 @@ package foundation.e.apps.data.parentalcontrol import android.content.Context import androidx.core.net.toUri import dagger.hilt.android.qualifiers.ApplicationContext import org.e.parentalcontrol.data.model.TypeAppManagement import javax.inject.Inject import javax.inject.Singleton import androidx.core.net.toUri @Singleton class ParentalControlRepository @Inject constructor( Loading Loading @@ -51,18 +52,18 @@ class ParentalControlRepository @Inject constructor( return Age.PARENTAL_CONTROL_DISABLED } fun getSelectedProtectionMode(): ProtectionMode { fun getSelectedTypeAppManagement(): TypeAppManagement { val uri = URI_PARENTAL_CONTROL_INSTALL_TYPE_APP_MANAGEMENT.toUri() val cursor = context.contentResolver.query(uri, null, null, null, null) cursor?.use { if (it.moveToFirst()) { val protectionMode = it.getInt(it.getColumnIndexOrThrow("protectionmode")) return ProtectionMode.entries[protectionMode] return TypeAppManagement.entries[protectionMode] } } return ProtectionMode.DISABLED_MODE return TypeAppManagement.DISABLED_MODE } } Loading @@ -74,9 +75,3 @@ enum class Age { SEVENTEEN, PARENTAL_CONTROL_DISABLED } enum class ProtectionMode { REGULAR_MODE, REQUEST_PIN_MODE, DISABLED_MODE }
app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt +6 −6 Original line number Diff line number Diff line /* * Copyright (C) 2024 MURENA SAS * Copyright (C) 2025 MURENA SAS * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by Loading Loading @@ -29,11 +29,11 @@ import foundation.e.apps.data.parentalcontrol.Age import foundation.e.apps.data.parentalcontrol.ContentRatingDao import foundation.e.apps.data.parentalcontrol.ParentalControlRepository import foundation.e.apps.data.parentalcontrol.ParentalControlRepository.Companion.KEY_PARENTAL_GUIDANCE import foundation.e.apps.data.parentalcontrol.ProtectionMode import foundation.e.apps.data.parentalcontrol.fdroid.FDroidAntiFeatureRepository import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingGroup import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingRepository import foundation.e.apps.domain.model.ContentRatingValidity import org.e.parentalcontrol.data.model.TypeAppManagement import timber.log.Timber import javax.inject.Inject Loading @@ -53,8 +53,8 @@ class ValidateAppAgeLimitUseCase @Inject constructor( private val ageGroup: Age get() = parentalControlRepository.getSelectedAgeGroup() private val protectionMode: ProtectionMode get() = parentalControlRepository.getSelectedProtectionMode() private val typeAppManagement: TypeAppManagement get() = parentalControlRepository.getSelectedTypeAppManagement() suspend operator fun invoke(app: AppInstall): ResultSupreme<ContentRatingValidity> { Loading Loading @@ -123,7 +123,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor( ageGroup: Age, app: AppInstall ): ResultSupreme<ContentRatingValidity> { if (protectionMode == ProtectionMode.REGULAR_MODE) { if (typeAppManagement == TypeAppManagement.CONTENT_RATING) { val allowedContentRating = gPlayContentRatingRepository.contentRatingGroups.find { it.id == ageGroup.toString() } Loading Loading @@ -181,7 +181,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor( } private suspend fun isParentalGuidance(app: AppInstall): Boolean { if (protectionMode == ProtectionMode.REGULAR_MODE) { if (typeAppManagement == TypeAppManagement.CONTENT_RATING) { val fetchedContentRating = gPlayContentRatingRepository.getEnglishContentRating(app.packageName) return fetchedContentRating?.id == KEY_PARENTAL_GUIDANCE Loading
parental-control-data/README.md 0 → 100644 +18 −0 Original line number Diff line number Diff line # App Lounge library This document describes the library used for sharing information between applications: - AppLounge - ParentalControl # Versions ## 1.0.0 Initial version : ParentalControlContract ## 1.1.0 TypeAppManagement: - CONTENT_RATING Legacy mode validation based on age - SECURITY_CODE Security code request by the Parental Controls application - DISABLED_MODE No restriction No newline at end of file
parental-control-data/build.gradle +1 −1 Original line number Diff line number Diff line Loading @@ -14,7 +14,7 @@ publishing { jar(MavenPublication) { groupId = 'foundation.e.apps' artifactId = 'ParentalControlData' version = '1.0.0' version = '1.1.0' artifact("$buildDir/libs/${project.name}.jar") Loading
parental-control-data/src/main/java/org/e/parentalcontrol/data/model/TypeAppManagement.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line /* * Copyright MURENA SAS 2025 * Apps Quickly and easily install Android apps onto your device! * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <https://www.gnu.org/licenses/>. * */ package org.e.parentalcontrol.data.model enum class TypeAppManagement { CONTENT_RATING, // Legacy mode validation based on age SECURITY_CODE, // Security code request by the Parental Controls application DISABLED_MODE // No restriction } No newline at end of file