diff options
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) |