summaryrefslogtreecommitdiff
path: root/app/src/main/java/foundation/e/privacycentralapp
diff options
context:
space:
mode:
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp')
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt14
1 files changed, 10 insertions, 4 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt
index 947e8e9..cb9fcd5 100644
--- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt
+++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt
@@ -20,6 +20,10 @@ package foundation.e.privacycentralapp.domain.usecases
import foundation.e.privacycentralapp.data.repositories.AppListsRepository
import foundation.e.privacycentralapp.data.repositories.LocalStateRepository
import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode
+import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode.HIDE_IP
+import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode.HIDE_IP_LOADING
+import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode.REAL_IP
+import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode.REAL_IP_LOADING
import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule
import foundation.e.privacymodules.permissions.IPermissionsPrivacyModule
import foundation.e.privacymodules.permissions.data.ApplicationDescription
@@ -126,14 +130,16 @@ class IpScramblingStateUseCase(
}
private fun applySettings(isQuickPrivacyEnabled: Boolean, isIpScramblingEnabled: Boolean) {
- val mode = localStateRepository.internetPrivacyMode.value
+ val settingEnabled = isQuickPrivacyEnabled && isIpScramblingEnabled
+ val currentMode = localStateRepository.internetPrivacyMode.value
+
when {
- isQuickPrivacyEnabled && isIpScramblingEnabled &&
- mode in setOf(InternetPrivacyMode.REAL_IP, InternetPrivacyMode.REAL_IP_LOADING) ->
+ settingEnabled && currentMode in setOf(REAL_IP, REAL_IP_LOADING) ->
applyStartIpScrambling()
- mode in setOf(InternetPrivacyMode.HIDE_IP, InternetPrivacyMode.HIDE_IP_LOADING) ->
+ !settingEnabled && currentMode in setOf(HIDE_IP, HIDE_IP_LOADING) ->
ipScramblerModule.stop()
+
else -> {}
}
}