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

Commit fd2f214f authored by Jonathan Klee's avatar Jonathan Klee
Browse files

Change the way we are fetching privacy data

parent 3c802e15
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -7,6 +7,7 @@ plugins {
    id 'androidx.navigation.safeargs.kotlin'
    id 'com.google.dagger.hilt.android'
    id 'kotlin-allopen'
    id 'kotlin-parcelize'
}

def versionMajor = 2
+4 −9
Original line number Diff line number Diff line
@@ -38,7 +38,6 @@ data class Application(
    val category: String = String(),
    val description: String = String(),
    var perms: List<String> = emptyList(),
    var trackers: List<String> = emptyList(),
    var reportId: Long = -1L,
    val icon_image_path: String = String(),
    val last_modified: String = String(),
@@ -65,17 +64,13 @@ data class Application(
    var type: Type = NATIVE,
    var privacyScore: Int = -1,
    var isPurchased: Boolean = false,
    var updatedOn: String = String(),

    /*
     * List of permissions from Exodus API.
     * This list is now used to calculate the privacy score instead of perms variable above.
     * If the value is LIST_OF_NULL - listOf("null"), it means no data is available in Exodus API for this package,
     * hence display "N/A"
     *
     * Issue: https://gitlab.e.foundation/e/backlog/-/issues/5136
     * Number of permissions and trackers from Exodus Api used for privacy score calculation.
     */
    var permsFromExodus: List<String> = LIST_OF_NULL,
    var updatedOn: String = String(),
    var numberOfPermission: Int = 0,
    var numberOfTracker: Int = 0,

    /*
     * Store restriction from App.
+0 −1
Original line number Diff line number Diff line
@@ -34,7 +34,6 @@ fun App.toApplication(context: Context): Application {
        author = this.developerName,
        category = this.categoryName,
        description = this.description,
        perms = this.permissions,
        icon_image_path = this.iconArtwork.url,
        last_modified = this.updatedOn,
        latest_version_code = this.versionCode,
+0 −26
Original line number Diff line number Diff line
package foundation.e.apps.data.exodus

import retrofit2.Response
import retrofit2.http.GET
import retrofit2.http.Headers
import retrofit2.http.Path
import retrofit2.http.Query

interface ExodusTrackerApi {

    companion object {
        const val BASE_URL = "https://exodus.ecloud.global/api/"
        const val CACHE_DURATION_SECONDS = 86400 // 1 day
    }

    @Headers("Cache-Control: public, max-age=$CACHE_DURATION_SECONDS")
    @GET("trackers")
    suspend fun getTrackerList(@Query("date") date: String): Response<Trackers>

    @Headers("Cache-Control: public, max-age=$CACHE_DURATION_SECONDS")
    @GET("search/{appHandle}/details")
    suspend fun getTrackerInfoOfApp(
        @Path("appHandle") appHandle: String,
        @Query("v") versionCode: Int,
    ): Response<List<Report>>
}
+19 −8
Original line number Diff line number Diff line
package foundation.e.apps.data.exodus

import com.squareup.moshi.Json
import com.google.gson.annotations.SerializedName

data class ApiResponse(
    val results: List<Report>
)

data class Report(
    val report: Long = -1L,
    @Json(name = "updated") val updatedAt: String,
    @Json(name = "version_name") val version: String,
    @Json(name = "version_code") val versionCode: String,
    val source: String,
    val trackers: List<Long>,
    val permissions: List<String> = listOf()
    val id: Int,
    val handle: String,
    val name: String,
    val creator: String,
    val downloads: String,
    @SerializedName("app_uid") val appUid: String,
    @SerializedName("icon_phash") val iconPhash: String,
    @SerializedName("report_updated_at") val reportUpdatedAt: Double,
    @SerializedName("permissions_count") val permissionsCount: Int,
    @SerializedName("trackers_count") val trackersCount: Int,
    @SerializedName("permissions_class") val permissionsClass: String,
    @SerializedName("trackers_class") val trackersClass: String,
    val version: String
)
Loading