From b9b0f890b95ff1674d4e8e9396a16a68d82829e7 Mon Sep 17 00:00:00 2001 From: jacquarg Date: Wed, 4 May 2022 19:17:40 +0200 Subject: Update PR --- app/src/main/AndroidManifest.xml | 3 +-- .../domain/usecases/TrackersStatisticsUseCase.kt | 22 +++++++++++----------- 2 files changed, 12 insertions(+), 13 deletions(-) (limited to 'app/src') diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index b288588..d285b6f 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -63,8 +63,7 @@ android:launchMode="singleTask"> - - + diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt index d8eed5c..1fddb74 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStatisticsUseCase.kt @@ -176,18 +176,18 @@ class TrackersStatisticsUseCase( blockedLeaks = blockedLeaks, leaks = leaks ) - }.sortedWith( - Comparator { o1, o2 -> - val leaks = o2.leaks - o1.leaks - if (leaks != 0) leaks else { - val whitelisted = o2.whiteListedTrackersCount - o1.whiteListedTrackersCount - if (whitelisted != 0) whitelisted else { - o2.trackersCount - o1.trackersCount - } - } - } - ) + }.sortedWith(mostLeakedAppsComparator) + } + } + + private val mostLeakedAppsComparator: Comparator = Comparator { o1, o2 -> + val leaks = o2.leaks - o1.leaks + if (leaks != 0) leaks else { + val whitelisted = o2.whiteListedTrackersCount - o1.whiteListedTrackersCount + if (whitelisted != 0) whitelisted else { + o2.trackersCount - o1.trackersCount } + } } fun getNonBlockedTrackersCount(): Flow { -- cgit v1.2.1