diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingGroup.kt b/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingGroup.kt
deleted file mode 100644
index ec2be627ee096d09fc6ee33f6404be321f8f1dfe..0000000000000000000000000000000000000000
--- a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingGroup.kt
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- * Copyright MURENA SAS 2024
- * 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 .
- *
- */
-
-package foundation.e.apps.data.blockedApps
-
-import com.squareup.moshi.Json
-
-data class ContentRatingGroup(
- val id: String,
- @Json(name = "age_group")
- val ageGroup: String,
- var ratings: List
-)
diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingParser.kt b/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingParser.kt
deleted file mode 100644
index cde87e63857918a0678281d366f0061905bc1954..0000000000000000000000000000000000000000
--- a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingParser.kt
+++ /dev/null
@@ -1,89 +0,0 @@
-/*
- * Copyright MURENA SAS 2024
- * 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 .
- *
- */
-
-package foundation.e.apps.data.blockedApps
-
-import com.google.gson.Gson
-import com.google.gson.JsonSyntaxException
-import com.google.gson.reflect.TypeToken
-import foundation.e.apps.data.install.FileManager
-import timber.log.Timber
-import java.io.File
-import java.io.IOException
-import javax.inject.Inject
-import javax.inject.Named
-
-class ContentRatingParser @Inject constructor(
- private val gson: Gson,
- @Named("cacheDir") private val cacheDir: String
-) {
-
- companion object {
- private const val CONTENT_RATINGS_FILE_NAME = "content_ratings.json"
- }
-
- fun parseContentRatingData(): List {
- return try {
- val outputPath = moveFile()
- val contentRatingJson = readJsonFromFile(outputPath)
- Timber.d("ContentRatings file contents: $contentRatingJson")
- parseJsonOfContentRatingGroup(contentRatingJson)
- } catch (exception: IOException) {
- handleException(exception)
- } catch (exception: JsonSyntaxException) {
- handleException(exception)
- }
- }
-
- private fun readJsonFromFile(outputPath: String): String {
- val downloadedFile =
- File(outputPath + CONTENT_RATINGS_FILE_NAME)
- val contentRatingJson = String(downloadedFile.inputStream().readBytes())
-
- return contentRatingJson
- }
-
- private fun moveFile(): String {
- val outputPath = "$cacheDir/content_ratings/"
- FileManager.moveFile(
- "$cacheDir/",
- CONTENT_RATINGS_FILE_NAME, outputPath
- )
-
- return outputPath
- }
-
- private fun parseJsonOfContentRatingGroup(contentRatingJson: String): List {
- val contentRatingsListTypeGroup = object : TypeToken>() {}.type
- val contentRatingGroups: List =
- gson.fromJson(contentRatingJson, contentRatingsListTypeGroup)
-
- return contentRatingGroups.map {
- it.ratings = it.ratings.map { rating ->
- rating.lowercase()
- }
- it
- }
- }
-
- private fun handleException(exception: Exception): List {
- Timber.e(exception.localizedMessage ?: "", exception)
- return listOf()
- }
-}
diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/ParentalControlRepository.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/ParentalControlRepository.kt
similarity index 56%
rename from app/src/main/java/foundation/e/apps/data/blockedApps/ParentalControlRepository.kt
rename to app/src/main/java/foundation/e/apps/data/parentalcontrol/ParentalControlRepository.kt
index 6cab641e34873363211bef205395976b37c97fff..d5279252a83cb99ffe0e2f07cec19e0f2cdc793a 100644
--- a/app/src/main/java/foundation/e/apps/data/blockedApps/ParentalControlRepository.kt
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/ParentalControlRepository.kt
@@ -1,23 +1,22 @@
/*
- * Copyright MURENA SAS 2024
- * Apps Quickly and easily install Android apps onto your device!
+ * Copyright (C) 2024 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * 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.
+ * 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*
*/
-package foundation.e.apps.data.blockedApps
+package foundation.e.apps.data.parentalcontrol
import android.content.Context
import android.net.Uri
diff --git a/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidAntiFeatureRepository.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidAntiFeatureRepository.kt
new file mode 100644
index 0000000000000000000000000000000000000000..5043d8acce197e2ff72c7c85ebacf18f4ab1123e
--- /dev/null
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidAntiFeatureRepository.kt
@@ -0,0 +1,36 @@
+/*
+ * Copyright (C) 2024 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
+ * 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 .
+ *
+ */
+
+package foundation.e.apps.data.parentalcontrol.fdroid
+
+import javax.inject.Inject
+import javax.inject.Singleton
+
+@Singleton
+class FDroidAntiFeatureRepository
+@Inject
+constructor(
+ private val fDroidMonitorApi: FDroidMonitorApi,
+) {
+ var fDroidNsfwApps = listOf()
+ private set
+
+ suspend fun fetchNsfwApps() {
+ fDroidNsfwApps = fDroidMonitorApi.getMonitorData().body()?.getNsfwApps() ?: emptyList()
+ }
+}
diff --git a/app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorApi.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorApi.kt
similarity index 94%
rename from app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorApi.kt
rename to app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorApi.kt
index 2d36c5d05b9825175b136c4b5af41c93f7d97e9d..0967b9e99c9f0e2f85f5e777cb43a2044a741e11 100644
--- a/app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorApi.kt
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorApi.kt
@@ -16,7 +16,7 @@
*
*/
-package foundation.e.apps.data.parentalcontrol
+package foundation.e.apps.data.parentalcontrol.fdroid
import retrofit2.Response
import retrofit2.http.GET
diff --git a/app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorData.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorData.kt
similarity index 90%
rename from app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorData.kt
rename to app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorData.kt
index b30c617943ea16867b9705e228f4a1f6cde842f0..3225a6417d7525063c4036dfae70010c281753e8 100644
--- a/app/src/main/java/foundation/e/apps/data/parentalcontrol/FDroidMonitorData.kt
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/fdroid/FDroidMonitorData.kt
@@ -16,14 +16,14 @@
*
*/
-package foundation.e.apps.data.parentalcontrol
+package foundation.e.apps.data.parentalcontrol.fdroid
import com.squareup.moshi.Json
data class FDroidMonitorData(
val antiFeatures: AntiFeatures
) {
- fun getNSFWApps() = antiFeatures.nsfw.apps
+ fun getNsfwApps() = antiFeatures.nsfw.apps
}
data class AntiFeatures(
diff --git a/app/src/main/java/foundation/e/apps/data/parentalcontrol/AgeGroupApi.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/AgeGroupApi.kt
similarity index 84%
rename from app/src/main/java/foundation/e/apps/data/parentalcontrol/AgeGroupApi.kt
rename to app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/AgeGroupApi.kt
index 7ccc0055081443bc8cd7fb9f5fe29e15fad776d4..80a40e317348c9be560a5ea00377e43e614f7a6a 100644
--- a/app/src/main/java/foundation/e/apps/data/parentalcontrol/AgeGroupApi.kt
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/AgeGroupApi.kt
@@ -16,9 +16,8 @@
*
*/
-package foundation.e.apps.data.parentalcontrol
+package foundation.e.apps.data.parentalcontrol.googleplay
-import foundation.e.apps.data.blockedApps.ContentRatingGroup
import retrofit2.Response
import retrofit2.http.GET
@@ -29,6 +28,6 @@ interface AgeGroupApi {
}
@GET("content_ratings.json?ref_type=heads")
- suspend fun getDefinedAgeGroups(): Response>
+ suspend fun getDefinedAgeGroups(): Response>
}
diff --git a/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingGroup.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingGroup.kt
new file mode 100644
index 0000000000000000000000000000000000000000..708e1f2780f97a125461f5550c7feec1579a424d
--- /dev/null
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingGroup.kt
@@ -0,0 +1,28 @@
+/*
+ * Copyright (C) 2024 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
+ * 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 .
+ *
+ */
+
+package foundation.e.apps.data.parentalcontrol.googleplay
+
+import com.squareup.moshi.Json
+
+data class GPlayContentRatingGroup(
+ val id: String,
+ @Json(name = "age_group")
+ val ageGroup: String,
+ var ratings: List
+)
diff --git a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingRepository.kt
similarity index 71%
rename from app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt
rename to app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingRepository.kt
index b09fbb43cab0b7411dd6a47277c1f905e3967429..28d03c09d3c8670d071b767bad18811f62a54670 100644
--- a/app/src/main/java/foundation/e/apps/data/blockedApps/ContentRatingsRepository.kt
+++ b/app/src/main/java/foundation/e/apps/data/parentalcontrol/googleplay/GPlayContentRatingRepository.kt
@@ -16,30 +16,24 @@
*
*/
-package foundation.e.apps.data.blockedApps
+package foundation.e.apps.data.parentalcontrol.googleplay
import com.aurora.gplayapi.data.models.ContentRating
-import foundation.e.apps.data.parentalcontrol.AgeGroupApi
-import foundation.e.apps.data.parentalcontrol.FDroidMonitorApi
import foundation.e.apps.data.handleNetworkResult
import foundation.e.apps.data.playstore.PlayStoreRepository
import javax.inject.Inject
import javax.inject.Singleton
@Singleton
-class ContentRatingsRepository @Inject constructor(
+class GPlayContentRatingRepository @Inject constructor(
private val ageGroupApi: AgeGroupApi,
- private val fDroidMonitorApi: FDroidMonitorApi,
private val playStoreRepository: PlayStoreRepository,
) {
- private var _contentRatingGroups = listOf()
- val contentRatingGroups: List
+ private var _contentRatingGroups = listOf()
+ val contentRatingGroups: List
get() = _contentRatingGroups
- var fDroidNSFWApps = listOf()
- private set
-
suspend fun fetchContentRatingData() {
val response = ageGroupApi.getDefinedAgeGroups()
if (response.isSuccessful) {
@@ -47,10 +41,6 @@ class ContentRatingsRepository @Inject constructor(
}
}
- suspend fun fetchNSFWApps() {
- fDroidNSFWApps = fDroidMonitorApi.getMonitorData().body()?.getNSFWApps() ?: emptyList()
- }
-
suspend fun getEnglishContentRating(packageName: String): ContentRating? {
return handleNetworkResult {
playStoreRepository.getEnglishContentRating(packageName)
diff --git a/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt b/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt
index f76699090746b8f6d26d103a56ac8aea9a150916..576302cc9e076d7567adbfd6dc3eb471ccd7e21f 100644
--- a/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt
+++ b/app/src/main/java/foundation/e/apps/di/network/RetrofitApiModule.kt
@@ -29,9 +29,9 @@ import foundation.e.apps.data.cleanapk.CleanApkRetrofit
import foundation.e.apps.data.ecloud.EcloudApiInterface
import foundation.e.apps.data.exodus.ExodusTrackerApi
import foundation.e.apps.data.fdroid.FdroidApiInterface
+import foundation.e.apps.data.parentalcontrol.fdroid.FDroidMonitorApi
+import foundation.e.apps.data.parentalcontrol.googleplay.AgeGroupApi
import foundation.e.apps.di.network.NetworkModule.getYamlFactory
-import foundation.e.apps.data.parentalcontrol.AgeGroupApi
-import foundation.e.apps.data.parentalcontrol.FDroidMonitorApi
import okhttp3.OkHttpClient
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
diff --git a/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt b/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt
index f94648b500c907d8039edec57616afd606606a07..05cbe5c93da3ebcf26020b62e410ef0f8907156a 100644
--- a/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt
+++ b/app/src/main/java/foundation/e/apps/domain/ValidateAppAgeLimitUseCase.kt
@@ -20,18 +20,20 @@ package foundation.e.apps.domain
import foundation.e.apps.data.ResultSupreme
import foundation.e.apps.data.application.apps.AppsApi
-import foundation.e.apps.data.blockedApps.Age
-import foundation.e.apps.data.blockedApps.ContentRatingGroup
-import foundation.e.apps.data.blockedApps.ContentRatingsRepository
-import foundation.e.apps.data.blockedApps.ParentalControlRepository
+import foundation.e.apps.data.parentalcontrol.Age
+import foundation.e.apps.data.parentalcontrol.ParentalControlRepository
import foundation.e.apps.data.enums.Origin
import foundation.e.apps.data.enums.Type
import foundation.e.apps.data.install.models.AppInstall
+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 timber.log.Timber
import javax.inject.Inject
class ValidateAppAgeLimitUseCase @Inject constructor(
- private val contentRatingRepository: ContentRatingsRepository,
+ private val gPlayContentRatingRepository: GPlayContentRatingRepository,
+ private val fDroidAntiFeatureRepository: FDroidAntiFeatureRepository,
private val parentalControlRepository: ParentalControlRepository,
private val appsApi: AppsApi,
) {
@@ -73,7 +75,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor(
}
private fun isKnownNsfwApp(app: AppInstall): Boolean {
- return app.packageName in contentRatingRepository.fDroidNSFWApps
+ return app.packageName in fDroidAntiFeatureRepository.fDroidNsfwApps
}
private fun validateAgeLimit(
@@ -81,7 +83,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor(
app: AppInstall
): ResultSupreme.Success {
val allowedContentRating =
- contentRatingRepository.contentRatingGroups.find { it.id == ageGroup.toString() }
+ gPlayContentRatingRepository.contentRatingGroups.find { it.id == ageGroup.toString() }
Timber.d(
"Selected age group: $ageGroup \n" +
@@ -97,7 +99,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor(
private fun isValidAppAgeRating(
app: AppInstall,
- allowedContentRating: ContentRatingGroup?
+ allowedContentRating: GPlayContentRatingGroup?
): Boolean {
val allowedAgeRatings = allowedContentRating?.ratings?.map { it.lowercase() } ?: emptyList()
return app.contentRating.id.isNotEmpty() && allowedAgeRatings.contains(app.contentRating.id)
@@ -108,7 +110,7 @@ class ValidateAppAgeLimitUseCase @Inject constructor(
private suspend fun verifyContentRatingExists(app: AppInstall): Boolean {
if (app.contentRating.id.isEmpty()) {
- contentRatingRepository.getEnglishContentRating(app.packageName)?.run {
+ gPlayContentRatingRepository.getEnglishContentRating(app.packageName)?.run {
Timber.d("Updating content rating for package: ${app.packageName}")
app.contentRating = this
}
diff --git a/app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt b/app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt
index 2c3531016864ae075fc52762d16f788bf120139b..86fdf8c15065f71e9482aa7c07ee02087fab5db1 100644
--- a/app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt
+++ b/app/src/main/java/foundation/e/apps/provider/AgeRatingProvider.kt
@@ -1,19 +1,18 @@
/*
- * Copyright MURENA SAS 2024
- * Apps Quickly and easily install Android apps onto your device!
+ * Copyright (C) 2024 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
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
+ * 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.
+ * 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 .
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see .
*
*/
@@ -23,7 +22,6 @@ import android.app.NotificationChannel
import android.app.NotificationManager
import android.content.ContentProvider
import android.content.ContentValues
-import android.content.Context
import android.content.UriMatcher
import android.database.Cursor
import android.database.MatrixCursor
@@ -41,10 +39,11 @@ import foundation.e.apps.contract.ParentalControlContract.COLUMN_PACKAGE_NAME
import foundation.e.apps.contract.ParentalControlContract.PATH_BLOCKLIST
import foundation.e.apps.contract.ParentalControlContract.PATH_LOGIN_TYPE
import foundation.e.apps.contract.ParentalControlContract.getAppLoungeProviderAuthority
-import foundation.e.apps.data.blockedApps.ContentRatingsRepository
import foundation.e.apps.data.enums.Origin
import foundation.e.apps.data.install.models.AppInstall
import foundation.e.apps.data.login.AuthenticatorRepository
+import foundation.e.apps.data.parentalcontrol.fdroid.FDroidAntiFeatureRepository
+import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingRepository
import foundation.e.apps.data.preference.DataStoreManager
import foundation.e.apps.domain.ValidateAppAgeLimitUseCase
import foundation.e.apps.install.pkg.AppLoungePackageManager
@@ -54,7 +53,6 @@ import kotlinx.coroutines.awaitAll
import kotlinx.coroutines.runBlocking
import kotlinx.coroutines.withContext
import timber.log.Timber
-import javax.inject.Inject
class AgeRatingProvider : ContentProvider() {
@@ -63,10 +61,10 @@ class AgeRatingProvider : ContentProvider() {
interface ContentProviderEntryPoint {
fun provideAuthenticationRepository(): AuthenticatorRepository
fun providePackageManager(): AppLoungePackageManager
- fun provideContentRatingsRepository(): ContentRatingsRepository
+ fun provideGPlayContentRatingsRepository(): GPlayContentRatingRepository
+ fun provideFDroidAntiFeatureRepository(): FDroidAntiFeatureRepository
fun provideValidateAppAgeLimitUseCase(): ValidateAppAgeLimitUseCase
fun provideDataStoreManager(): DataStoreManager
-
fun provideNotificationManager(): NotificationManager
}
@@ -77,7 +75,8 @@ class AgeRatingProvider : ContentProvider() {
private lateinit var authenticatorRepository: AuthenticatorRepository
private lateinit var appLoungePackageManager: AppLoungePackageManager
- private lateinit var contentRatingsRepository: ContentRatingsRepository
+ private lateinit var gPlayContentRatingRepository: GPlayContentRatingRepository
+ private lateinit var fDroidAntiFeatureRepository: FDroidAntiFeatureRepository
private lateinit var validateAppAgeLimitUseCase: ValidateAppAgeLimitUseCase
private lateinit var dataStoreManager: DataStoreManager
private lateinit var notificationManager: NotificationManager
@@ -173,13 +172,13 @@ class AgeRatingProvider : ContentProvider() {
private suspend fun ensureAgeGroupDataExists() {
withContext(IO) {
val deferredFetchRatings = async {
- if (contentRatingsRepository.contentRatingGroups.isEmpty()) {
- contentRatingsRepository.fetchContentRatingData()
+ if (gPlayContentRatingRepository.contentRatingGroups.isEmpty()) {
+ gPlayContentRatingRepository.fetchContentRatingData()
}
}
val deferredFetchNSFW = async {
- if (contentRatingsRepository.fDroidNSFWApps.isEmpty()) {
- contentRatingsRepository.fetchNSFWApps()
+ if (fDroidAntiFeatureRepository.fDroidNsfwApps.isEmpty()) {
+ fDroidAntiFeatureRepository.fetchNsfwApps()
}
}
listOf(deferredFetchRatings, deferredFetchNSFW).awaitAll()
@@ -252,7 +251,8 @@ class AgeRatingProvider : ContentProvider() {
authenticatorRepository = hiltEntryPoint.provideAuthenticationRepository()
appLoungePackageManager = hiltEntryPoint.providePackageManager()
- contentRatingsRepository = hiltEntryPoint.provideContentRatingsRepository()
+ gPlayContentRatingRepository = hiltEntryPoint.provideGPlayContentRatingsRepository()
+ fDroidAntiFeatureRepository = hiltEntryPoint.provideFDroidAntiFeatureRepository()
validateAppAgeLimitUseCase = hiltEntryPoint.provideValidateAppAgeLimitUseCase()
dataStoreManager = hiltEntryPoint.provideDataStoreManager()
notificationManager = hiltEntryPoint.provideNotificationManager()
diff --git a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt
index 18a1671a98762545f768ca208acac1c88f4af16c..474308feee5eb73de4f517a430c8a8f950865c0e 100644
--- a/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt
+++ b/app/src/main/java/foundation/e/apps/ui/MainActivityViewModel.kt
@@ -35,13 +35,14 @@ 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.blockedApps.BlockedAppRepository
-import foundation.e.apps.data.blockedApps.ContentRatingsRepository
import foundation.e.apps.data.ecloud.EcloudRepository
import foundation.e.apps.data.enums.User
import foundation.e.apps.data.enums.isInitialized
import foundation.e.apps.data.enums.isUnFiltered
import foundation.e.apps.data.install.AppManagerWrapper
import foundation.e.apps.data.install.models.AppInstall
+import foundation.e.apps.data.parentalcontrol.fdroid.FDroidAntiFeatureRepository
+import foundation.e.apps.data.parentalcontrol.googleplay.GPlayContentRatingRepository
import foundation.e.apps.data.preference.AppLoungeDataStore
import foundation.e.apps.data.preference.getSync
import foundation.e.apps.install.pkg.AppLoungePackageManager
@@ -60,7 +61,8 @@ class MainActivityViewModel @Inject constructor(
private val pwaManager: PWAManager,
private val ecloudRepository: EcloudRepository,
private val blockedAppRepository: BlockedAppRepository,
- private val contentRatingsRepository: ContentRatingsRepository,
+ private val gPlayContentRatingRepository: GPlayContentRatingRepository,
+ private val fDroidAntiFeatureRepository: FDroidAntiFeatureRepository,
private val appInstallProcessor: AppInstallProcessor,
) : ViewModel() {
@@ -240,8 +242,8 @@ class MainActivityViewModel @Inject constructor(
fun updateContentRatings() {
viewModelScope.launch {
- contentRatingsRepository.fetchNSFWApps()
- contentRatingsRepository.fetchContentRatingData()
+ fDroidAntiFeatureRepository.fetchNsfwApps()
+ gPlayContentRatingRepository.fetchContentRatingData()
}
}
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 35aecadfdc2d214a3c206c7101bd75089e2cfdb7..e9a0980ae14da9fef1c74f032d6a8dce6d9a513f 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,7 +28,6 @@ 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
@@ -37,6 +36,7 @@ import foundation.e.apps.data.install.models.AppInstall
import foundation.e.apps.data.login.AuthObject
import foundation.e.apps.data.login.exceptions.CleanApkException
import foundation.e.apps.data.login.exceptions.GPlayException
+import foundation.e.apps.data.parentalcontrol.fdroid.FDroidAntiFeatureRepository
import foundation.e.apps.data.playstore.PlayStoreRepository
import foundation.e.apps.install.download.data.DownloadProgress
import foundation.e.apps.install.download.data.DownloadProgressLD
@@ -56,7 +56,7 @@ class ApplicationViewModel @Inject constructor(
private val applicationRepository: ApplicationRepository,
private val playStoreRepository: PlayStoreRepository,
private val appManagerWrapper: AppManagerWrapper,
- private val contentRatingsRepository: ContentRatingsRepository,
+ private val fDroidAntiFeatureRepository: FDroidAntiFeatureRepository,
) : LoadingViewModel() {
val applicationLiveData: MutableLiveData> = MutableLiveData()
@@ -239,7 +239,7 @@ class ApplicationViewModel @Inject constructor(
fun isOpenSourceSelected() = applicationRepository.isOpenSourceSelected()
fun isKnownNsfwApp(app: Application): Boolean {
- return app.package_name in contentRatingsRepository.fDroidNSFWApps
+ return app.package_name in fDroidAntiFeatureRepository.fDroidNsfwApps
}
}