diff options
author | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2022-09-30 06:26:17 +0000 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart@hoodbrains.com> | 2022-09-30 06:26:17 +0000 |
commit | 21c36aa3e659ca1863239de7bd11d522139f7a9e (patch) | |
tree | 3d86ed28a7d34669b0b8352ffa3374c5c2de06a5 /app/src/main/java/foundation/e/privacycentralapp/data | |
parent | 613617234962627eb974d9e058df0efabc18177b (diff) | |
parent | 2f3495908e533fed11d9b395ae294a386a110bcd (diff) | |
download | advanced-privacy-21c36aa3e659ca1863239de7bd11d522139f7a9e.tar.gz |
Merge branch '5561-inform_vpn_always_on_already_running' into 'main'
5561: alert user that alwaysOn 3rd party VPN is running.
See merge request e/os/advanced-privacy!94
Diffstat (limited to 'app/src/main/java/foundation/e/privacycentralapp/data')
-rw-r--r-- | app/src/main/java/foundation/e/privacycentralapp/data/repositories/LocalStateRepository.kt | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/LocalStateRepository.kt b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/LocalStateRepository.kt index af8646a..672f260 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/data/repositories/LocalStateRepository.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/data/repositories/LocalStateRepository.kt @@ -20,9 +20,12 @@ package foundation.e.privacycentralapp.data.repositories import android.content.Context import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode import foundation.e.privacycentralapp.domain.entities.LocationMode -import kotlinx.coroutines.flow.Flow +import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.MutableStateFlow +import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow +import kotlinx.coroutines.flow.asStateFlow +import kotlinx.coroutines.flow.update class LocalStateRepository(context: Context) { companion object { @@ -48,6 +51,13 @@ class LocalStateRepository(context: Context) { return isFirstActivation } + private val _otherVpnRunning = MutableSharedFlow<Boolean>() + suspend fun emitOtherVpnRunning() { + _otherVpnRunning.emit(true) + } + + val otherVpnRunning: SharedFlow<Boolean> = _otherVpnRunning + var quickPrivacyEnabledFlow: StateFlow<Boolean> = quickPrivacyEnabledMutableFlow val areAllTrackersBlocked: MutableStateFlow<Boolean> = MutableStateFlow(false) @@ -79,9 +89,13 @@ class LocalStateRepository(context: Context) { val locationMode: MutableStateFlow<LocationMode> = MutableStateFlow(LocationMode.REAL_LOCATION) - var isIpScramblingEnabled: Boolean - get() = sharedPref.getBoolean(KEY_IP_SCRAMBLING, true) - set(value) = set(KEY_IP_SCRAMBLING, value) + private val _ipScramblingSetting = MutableStateFlow(sharedPref.getBoolean(KEY_IP_SCRAMBLING, true)) + val ipScramblingSetting = _ipScramblingSetting.asStateFlow() + + fun setIpScramblingSetting(enabled: Boolean) { + set(KEY_IP_SCRAMBLING, enabled) + _ipScramblingSetting.update { enabled } + } val internetPrivacyMode: MutableStateFlow<InternetPrivacyMode> = MutableStateFlow(InternetPrivacyMode.REAL_IP) |