aboutsummaryrefslogtreecommitdiffstats
path: root/app/src/main/java/foundation/e/privacycentralapp/domain
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp/domain')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/domain/entities/TrackerMode.kt22
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt9
2 files changed, 29 insertions, 2 deletions
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 <https://www.gnu.org/licenses/>.
+ */
+
+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<Boolean> = combine(
+ val trackerMode: Flow<TrackerMode> = combine(
localStateRepository.quickPrivacyEnabledFlow,
localStateRepository.areAllTrackersBlocked
) { isQuickPrivacyEnabled, isAllTrackersBlocked ->
- isQuickPrivacyEnabled && isAllTrackersBlocked
+ when {
+ isQuickPrivacyEnabled && isAllTrackersBlocked -> TrackerMode.DENIED
+ isQuickPrivacyEnabled && !isAllTrackersBlocked -> TrackerMode.CUSTOM
+ else -> TrackerMode.VULNERABLE
+ }
}
val isLocationHidden: Flow<Boolean> = combine(