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

Commit 6205a4f0 authored by Guillaume Jacquart's avatar Guillaume Jacquart
Browse files

Merge branch '2995-technical_framework_for_weeklyreport' into 'main'

2995: select best report algorythm

See merge request !186
parents 89dc00f4 ca1c825c
Loading
Loading
Loading
Loading
Loading
+4 −3
Original line number Diff line number Diff line
@@ -17,9 +17,10 @@
 */

plugins {
    id 'com.android.application'
    id 'kotlin-android'
    id 'androidx.navigation.safeargs.kotlin'
    alias libs.plugins.android.application
    alias libs.plugins.kotlin.android
    alias libs.plugins.androidx.navigation.safeargs
    alias libs.plugins.kotlin.serialization
}

def getSentryDsn = { ->
+6 −0
Original line number Diff line number Diff line
@@ -41,6 +41,7 @@ import foundation.e.advancedprivacy.domain.usecases.TrackersAndAppsListsUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackersScreenUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackersStateUseCase
import foundation.e.advancedprivacy.domain.usecases.TrackersStatisticsUseCase
import foundation.e.advancedprivacy.domain.usecases.WeeklyReportUseCase
import foundation.e.advancedprivacy.dummy.CityDataSource
import foundation.e.advancedprivacy.externalinterfaces.permissions.IPermissionsPrivacyModule
import foundation.e.advancedprivacy.features.dashboard.DashboardViewModel
@@ -51,6 +52,7 @@ import foundation.e.advancedprivacy.features.trackers.TrackersPeriodViewModel
import foundation.e.advancedprivacy.features.trackers.TrackersViewModel
import foundation.e.advancedprivacy.features.trackers.apptrackers.AppTrackersViewModel
import foundation.e.advancedprivacy.features.trackers.trackerdetails.TrackerDetailsViewModel
import foundation.e.advancedprivacy.features.weeklyreport.WeeklyReportViewFactory
import foundation.e.advancedprivacy.ipscrambler.ipScramblerModule
import foundation.e.advancedprivacy.permissions.externalinterfaces.PermissionsPrivacyModuleImpl
import foundation.e.advancedprivacy.trackers.data.TrackersRepository
@@ -161,6 +163,8 @@ val appModule = module {
        TrackersScreenUseCase(localStateRepository = get())
    }

    singleOf(::WeeklyReportUseCase)

    single<IPermissionsPrivacyModule> {
        PermissionsPrivacyModuleImpl(context = androidContext())
    }
@@ -215,4 +219,6 @@ val appModule = module {
    viewModelOf(::FakeLocationViewModel)
    viewModelOf(::InternetPrivacyViewModel)
    viewModelOf(::DashboardViewModel)

    single { WeeklyReportViewFactory() }
}
+39 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 E FOUNDATION
 *
 * 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.advancedprivacy.domain.entities.weeklyreport

import foundation.e.advancedprivacy.domain.entities.DisplayableApp
import foundation.e.advancedprivacy.trackers.domain.entities.Tracker

sealed class DisplayableReport {
    abstract val report: WeeklyReport

    data class ReportText(
        override val report: WeeklyReport
    ) : DisplayableReport()

    data class ReportWithApp(
        override val report: WeeklyReport,
        val app: DisplayableApp
    ) : DisplayableReport()

    data class ReportWithTracker(
        override val report: WeeklyReport,
        val tracker: Tracker
    ) : DisplayableReport()
}
+49 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 E FOUNDATION
 *
 * 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.advancedprivacy.domain.entities.weeklyreport

import kotlinx.serialization.Serializable

@Serializable
data class WeeklyReport(
    val statType: StatType,
    val labelId: LabelId,
    val primaryValue: String,
    val secondaryValues: List<String>
) {
    @Serializable
    enum class StatType {
        CALLS_PER_APP,
        NEW_TRACKER,
        CALLS_AND_LEAKS,
        TRACKER_WITH_MOST_APPS
    }

    @Serializable
    enum class LabelId {
        CALLS_PER_APP_1,
        CALLS_PER_APP_2,
        CALLS_PER_APP_3,
        NEW_TRACKER_1,
        NEW_TRACKER_2,
        NEW_TRACKER_3,
        CALLS_AND_LEAKS_1,
        CALLS_AND_LEAKS_2,
        TRACKER_WITH_MOST_APPS_1
    }
}
+23 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2025 E FOUNDATION
 *
 * 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.advancedprivacy.domain.entities.weeklyreport

data class WeeklyReportScore(
    val weeklyReport: WeeklyReport,
    val score: Long
)
Loading