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

Commit eb0fdedf authored by Fahim M. Choudhury's avatar Fahim M. Choudhury
Browse files

refactor: improve code organization for OkHttp interceptors, Retrofit APIs and Hilt modules

This commit includes the addition of a network module and updates to the retrofit module. The newly added network module includes the configuration for OkHttpClient and different deserializers. Some of the deserializers added include Moshi, Gson, and JacksonConverterFactory for YAML files.

In addition to this, the retrofit module has been updated to include different APIs such as CleanApkRetrofit, CleanApkAppDetailsRetrofit, ExodusTrackerApi, FdroidApiInterface, EcloudApiInterface, AgeGroupApi, and FDroidMonitorApi.

Furthermore, there are also some changes in the directory structure of the codebase. The ageRating package has been renamed to parentalcontrol, and the RetrofitModule has been moved to the network package.

Lastly, the commit includes the addition of the okhttp3 logging interceptor in the build.gradle file.
parent 4ee06ff5
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -219,6 +219,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'
+0 −34
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 retrofit2.Response
import retrofit2.http.GET

interface FDroidMonitorApi {

    companion object {
        const val BASE_URL = "https://f-droid.org/repo/"
    }

    @GET("status/update.json")
    suspend fun getMonitorData(): Response<FDroidMonitorData>

}
+0 −36
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 com.squareup.moshi.Json

data class FDroidMonitorData(
    val antiFeatures: AntiFeatures
) {
    fun getNSFWApps() = antiFeatures.nsfw.apps
}

data class AntiFeatures(
    @Json(name = "NSFW") val nsfw: NSFW
)

data class NSFW(
    val apps: List<String>
)
+13 −16
Original line number Diff line number Diff line
/*
 *  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
@@ -20,11 +19,9 @@
package foundation.e.apps.data.blockedApps

import com.aurora.gplayapi.data.models.ContentRating
import com.aurora.gplayapi.helpers.ContentRatingHelper
import foundation.e.apps.data.ageRating.AgeGroupApi
import foundation.e.apps.data.ageRating.FDroidMonitorApi
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.login.AuthenticatorRepository
import foundation.e.apps.data.playstore.PlayStoreRepository
import javax.inject.Inject
import javax.inject.Singleton
+19 −1
Original line number Diff line number Diff line
/*
 * 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 <https://www.gnu.org/licenses/>.
 *
 */

package foundation.e.apps.data.fdroid

import foundation.e.apps.data.fdroid.models.FdroidApiModel
@@ -7,7 +25,7 @@ import retrofit2.http.Path

/**
 * Interface for retrofit calls.
 * Created from [foundation.e.apps.data.cleanapk.RetrofitModule.provideFdroidApi].
 * Created from [foundation.e.apps.di.network.RetrofitApiModule.provideFdroidApi].
 */
interface FdroidApiInterface {

Loading