diff options
author | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-10-14 10:25:52 +0200 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-10-26 14:01:43 +0200 |
commit | fdeecefd34c00b225bd58f6cc7135a95e21728f1 (patch) | |
tree | ff8495da3b0d75d9f1d44bb14b6dac4cf027b9ae /app/src/main | |
parent | 5f02fd142ca438a48423340aeb9a36b017a6be83 (diff) |
PR suggestions, make apply Hide Ip clearer
Diffstat (limited to 'app/src/main')
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/domain/usecases/IpScramblingStateUseCase.kt | 14 |
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 -> {} } } |