From b9b0f890b95ff1674d4e8e9396a16a68d82829e7 Mon Sep 17 00:00:00 2001 From: jacquarg Date: Wed, 4 May 2022 19:17:40 +0200 Subject: Update PR --- .../domain/usecases/TrackersStatisticsUseCase.kt | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-) (limited to 'app/src/main/java/foundation/e/privacycentralapp') 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