summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com>2022-10-14 10:25:52 +0200
committerGuillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com>2022-10-26 14:01:43 +0200
commitfdeecefd34c00b225bd58f6cc7135a95e21728f1 (patch)
treeff8495da3b0d75d9f1d44bb14b6dac4cf027b9ae
parent5f02fd142ca438a48423340aeb9a36b017a6be83 (diff)
PR suggestions, make apply Hide Ip clearer
-rw-r--r--app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt14
-rw-r--r--trackers/src/main/java/foundation/e/privacymodules/trackers/DNSBlockerRunnable.kt4
2 files changed, 12 insertions, 6 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 -> {}
}
}
diff --git a/trackers/src/main/java/foundation/e/privacymodules/trackers/DNSBlockerRunnable.kt b/trackers/src/main/java/foundation/e/privacymodules/trackers/DNSBlockerRunnable.kt
index 42037e2..737aa4a 100644
--- a/trackers/src/main/java/foundation/e/privacymodules/trackers/DNSBlockerRunnable.kt
+++ b/trackers/src/main/java/foundation/e/privacymodules/trackers/DNSBlockerRunnable.kt
@@ -32,7 +32,7 @@ import java.io.InputStreamReader
import java.io.PrintWriter
class DNSBlockerRunnable(
- ct: Context,
+ context: Context,
private val trackersLogger: TrackersLogger,
private val trackersRepository: TrackersRepository,
private val whitelistRepository: WhitelistRepository
@@ -48,7 +48,7 @@ class DNSBlockerRunnable(
}
init {
- initEBrowserDoTFix(ct)
+ initEBrowserDoTFix(context)
}
@Synchronized