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

Verified Commit 21ca6d77 authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

feat: implement fetching NSFW anti-features from F-Droid

parent 7ca2766d
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -217,6 +217,7 @@ dependencies {
    implementation "com.squareup.moshi:moshi-kotlin:1.13.0"
//    implementation "com.squareup.moshi:moshi-adapters:1.5.0"
    implementation "com.squareup.okhttp3:okhttp:4.9.2"
    implementation "com.squareup.okhttp3:logging-interceptor:4.9.2"

    // JSON Converter
    implementation 'com.squareup.retrofit2:converter-gson:2.5.0'
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@
    <ID>LongParameterList:ApplicationViewModel.kt$ApplicationViewModel$( id: String, packageName: String, origin: Origin, isFdroidLink: Boolean, authObjectList: List&lt;AuthObject&gt;, retryBlock: (failedObjects: List&lt;AuthObject&gt;) -&gt; Boolean, )</ID>
    <ID>LongParameterList:CleanApkRetrofit.kt$CleanApkRetrofit$( @Query("keyword") keyword: String, @Query("source") source: String = APP_SOURCE_FOSS, @Query("type") type: String = APP_TYPE_ANY, @Query("nres") nres: Int = 20, @Query("page") page: Int = 1, @Query("by") by: String? = null, )</ID>
    <ID>LongParameterList:EglExtensionProvider.kt$EglExtensionProvider$( egl10: EGL10, eglDisplay: EGLDisplay, eglConfig: EGLConfig?, ai: IntArray, ai1: IntArray?, set: MutableSet&lt;String&gt; )</ID>
    <ID>LongParameterList:MainActivityViewModel.kt$MainActivityViewModel$( private val appLoungeDataStore: AppLoungeDataStore, private val applicationRepository: ApplicationRepository, private val appManagerWrapper: AppManagerWrapper, private val appLoungePackageManager: AppLoungePackageManager, private val pwaManager: PWAManager, private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, private val contentRatingsRepository: ContentRatingsRepository, private val appInstallProcessor: AppInstallProcessor, )</ID>
    <ID>LongParameterList:MainActivityViewModel.kt$MainActivityViewModel$( private val appLoungeDataStore: AppLoungeDataStore, private val applicationRepository: ApplicationRepository, private val appManagerWrapper: AppManagerWrapper, private val appLoungePackageManager: AppLoungePackageManager, private val pwaManager: PWAManager, private val ecloudRepository: EcloudRepository, private val blockedAppRepository: BlockedAppRepository, private val googlePlayContentRatingsRepository: GooglePlayContentRatingsRepository, private val appInstallProcessor: AppInstallProcessor, )</ID>
    <ID>LongParameterList:UpdatesManagerImpl.kt$UpdatesManagerImpl$( @ApplicationContext private val context: Context, private val appLoungePackageManager: AppLoungePackageManager, private val applicationRepository: ApplicationRepository, private val faultyAppRepository: FaultyAppRepository, private val appLoungePreference: AppLoungePreference, private val fdroidRepository: FdroidRepository, private val blockedAppRepository: BlockedAppRepository, )</ID>
    <ID>LongParameterList:UpdatesWorker.kt$UpdatesWorker$( @Assisted private val context: Context, @Assisted private val params: WorkerParameters, private val updatesManagerRepository: UpdatesManagerRepository, private val dataStoreManager: DataStoreManager, private val authenticatorRepository: AuthenticatorRepository, private val appInstallProcessor: AppInstallProcessor, private val blockedAppRepository: BlockedAppRepository, )</ID>
    <ID>MagicNumber:AnonymousLoginManager.kt$AnonymousLoginManager$200</ID>
+2 −2
Original line number Diff line number Diff line
/*
 * Copyright MURENA SAS 2023
 * 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
@@ -14,6 +13,7 @@
 *
 * 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 foundation.e.apps.data
+0 −35
Original line number Diff line number Diff line
/*
 *  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 <https://www.gnu.org/licenses/>.
 *
 */

package foundation.e.apps.data.ageRating

import foundation.e.apps.data.blockedApps.ContentRatingGroup
import retrofit2.Response
import retrofit2.http.GET

interface AgeGroupApi {

    companion object {
        const val BASE_URL = "https://gitlab.e.foundation/e/os/app-lounge-content-ratings/-/raw/main/"
    }

    @GET("content_ratings.json?ref_type=heads")
    suspend fun getDefinedAgeGroups(): Response<List<ContentRatingGroup>>

}
+16 −10
Original line number Diff line number Diff line
@@ -101,8 +101,11 @@ data class Application(
    var filterLevel: FilterLevel = FilterLevel.UNKNOWN,
    var isGplayReplaced: Boolean = false,
    @SerializedName(value = "on_fdroid")
    val isFDroidApp: Boolean = false,
    var contentRating: ContentRating = ContentRating()
    private val isFDroidAppBackingField: Boolean? = null,
    val isFDroidApp: Boolean = isFDroidAppBackingField ?: isFDroid(type, origin),
    var contentRating: ContentRating = ContentRating(),
    @SerializedName(value = "antifeatures")
    val antiFeatures: List<Map<String, String>> = emptyList()
) {
    fun updateType() {
        this.type = if (this.is_pwa) PWA else NATIVE
@@ -117,14 +120,8 @@ data class Application(
    }
}

val Application.shareUri: Uri
    get() = when (type) {
        PWA -> Uri.parse(url)
        NATIVE -> when {
            isFDroidApp -> buildFDroidUri(package_name)
            else -> Uri.parse(shareUrl)
        }
    }
internal fun isFDroid(type: Type, origin: Origin) =
    (type == NATIVE && origin == Origin.CLEANAPK)

private fun buildFDroidUri(packageName: String): Uri {
    return Uri.Builder()
@@ -134,3 +131,12 @@ private fun buildFDroidUri(packageName: String): Uri {
        .appendPath(packageName)
        .build()
}

val Application.shareUri: Uri
    get() = when (type) {
        PWA -> Uri.parse(url)
        NATIVE -> when {
            isFDroidApp -> buildFDroidUri(package_name)
            else -> Uri.parse(shareUrl)
        }
    }
Loading