From 0a8527b4947ce40b9864305139afedc59f00ad87 Mon Sep 17 00:00:00 2001 From: Guillaume Jacquart Date: Sat, 17 Sep 2022 18:24:52 +0200 Subject: 4208 Add CUSTOM state for tracker control. --- .../domain/entities/TrackerMode.kt | 22 ++++++++++++++++++++++ .../domain/usecases/GetQuickPrivacyStateUseCase.kt | 9 +++++++-- 2 files changed, 29 insertions(+), 2 deletions(-) create mode 100644 app/src/main/java/foundation/e/privacycentralapp/domain/entities/TrackerMode.kt (limited to 'app/src/main/java/foundation/e/privacycentralapp/domain') diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/entities/TrackerMode.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/entities/TrackerMode.kt new file mode 100644 index 0000000..ae70ba3 --- /dev/null +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/entities/TrackerMode.kt @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2022 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 . + */ + +package foundation.e.privacycentralapp.domain.entities + +enum class TrackerMode { + DENIED, CUSTOM, VULNERABLE +} \ No newline at end of file diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt index 7377568..a9c608e 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt @@ -22,6 +22,7 @@ import foundation.e.privacycentralapp.data.repositories.LocalStateRepository import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode import foundation.e.privacycentralapp.domain.entities.LocationMode import foundation.e.privacycentralapp.domain.entities.QuickPrivacyState +import foundation.e.privacycentralapp.domain.entities.TrackerMode import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.StateFlow @@ -64,11 +65,15 @@ class GetQuickPrivacyStateUseCase( } } - val isTrackersDenied: Flow = combine( + val trackerMode: Flow = combine( localStateRepository.quickPrivacyEnabledFlow, localStateRepository.areAllTrackersBlocked ) { isQuickPrivacyEnabled, isAllTrackersBlocked -> - isQuickPrivacyEnabled && isAllTrackersBlocked + when { + isQuickPrivacyEnabled && isAllTrackersBlocked -> TrackerMode.DENIED + isQuickPrivacyEnabled && !isAllTrackersBlocked -> TrackerMode.CUSTOM + else -> TrackerMode.VULNERABLE + } } val isLocationHidden: Flow = combine( -- cgit v1.2.3