diff options
Diffstat (limited to 'app/src')
35 files changed, 295 insertions, 375 deletions
diff --git a/app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt b/app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt index 670b81e..345307c 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/DependencyContainer.kt @@ -82,7 +82,7 @@ class DependencyContainer(val app: Application) { // Usecases val getQuickPrivacyStateUseCase by lazy { - GetQuickPrivacyStateUseCase(localStateRepository, GlobalScope) + GetQuickPrivacyStateUseCase(localStateRepository) } private val ipScramblingStateUseCase by lazy { IpScramblingStateUseCase( diff --git a/app/src/main/java/foundation/e/privacycentralapp/common/QuickPrivacyDisabledSnackbar.kt b/app/src/main/java/foundation/e/privacycentralapp/common/QuickPrivacyDisabledSnackbar.kt deleted file mode 100644 index 705f65d..0000000 --- a/app/src/main/java/foundation/e/privacycentralapp/common/QuickPrivacyDisabledSnackbar.kt +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2022 E FOUNDATION - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see <https://www.gnu.org/licenses/>. - */ - -package foundation.e.privacycentralapp.common - -import android.view.View -import com.google.android.material.snackbar.BaseTransientBottomBar -import com.google.android.material.snackbar.Snackbar -import foundation.e.privacycentralapp.R - -fun initQuickPrivacySnackbar(view: View, onDismiss: () -> Unit): Snackbar { - val snackbar = Snackbar.make(view, R.string.quickprivacy_disabled_message, Snackbar.LENGTH_INDEFINITE) - snackbar.setAction(R.string.close) { onDismiss() } - - snackbar.addCallback(object : BaseTransientBottomBar.BaseCallback<Snackbar>() { - override fun onDismissed(transientBottomBar: Snackbar?, event: Int) { - super.onDismissed(transientBottomBar, event) - if (event == DISMISS_EVENT_SWIPE) onDismiss() - } - }) - return snackbar -} 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 d39ee43..92ee0c1 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 @@ -24,14 +24,13 @@ import foundation.e.privacymodules.permissions.data.ApplicationDescription 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 { private const val SHARED_PREFS_FILE = "localState" - private const val KEY_QUICK_PRIVACY = "quickPrivacy" + private const val KEY_BLOCK_TRACKERS = "blockTrackers" private const val KEY_IP_SCRAMBLING = "ipScrambling" private const val KEY_FAKE_LOCATION = "fakeLocation" private const val KEY_FAKE_LATITUDE = "fakeLatitude" @@ -41,58 +40,48 @@ class LocalStateRepository(context: Context) { private val sharedPref = context.getSharedPreferences(SHARED_PREFS_FILE, Context.MODE_PRIVATE) - private val quickPrivacyEnabledMutableFlow = - MutableStateFlow<Boolean>(sharedPref.getBoolean(KEY_QUICK_PRIVACY, false)) - val isQuickPrivacyEnabled: Boolean get() = quickPrivacyEnabledMutableFlow.value + private val _blockTrackers = MutableStateFlow(sharedPref.getBoolean(KEY_BLOCK_TRACKERS, true)) + val blockTrackers = _blockTrackers.asStateFlow() - fun setQuickPrivacyReturnIsFirstActivation(value: Boolean): Boolean { - val isFirstActivation = value && !sharedPref.contains(KEY_QUICK_PRIVACY) - set(KEY_QUICK_PRIVACY, value) - quickPrivacyEnabledMutableFlow.value = value - return isFirstActivation + fun setBlockTrackers(enabled: Boolean) { + set(KEY_BLOCK_TRACKERS, enabled) + _blockTrackers.update { enabled } } - private val _otherVpnRunning = MutableSharedFlow<ApplicationDescription>() - suspend fun emitOtherVpnRunning(appDesc: ApplicationDescription) { - _otherVpnRunning.emit(appDesc) - } + val areAllTrackersBlocked: MutableStateFlow<Boolean> = MutableStateFlow(false) - val otherVpnRunning: SharedFlow<ApplicationDescription> = _otherVpnRunning + private val _fakeLocationEnabled = MutableStateFlow(sharedPref.getBoolean(KEY_FAKE_LOCATION, true)) - var quickPrivacyEnabledFlow: StateFlow<Boolean> = quickPrivacyEnabledMutableFlow + val fakeLocationEnabled = _fakeLocationEnabled.asStateFlow() - val areAllTrackersBlocked: MutableStateFlow<Boolean> = MutableStateFlow(false) + fun setFakeLocationEnabled(enabled: Boolean) { + set(KEY_FAKE_LOCATION, enabled) + _fakeLocationEnabled.update { enabled } + } - var fakeLocation: Pair<Float, Float>? - get() = if (sharedPref.getBoolean(KEY_FAKE_LOCATION, true)) - Pair( - // Initial default value is Quezon City - sharedPref.getFloat(KEY_FAKE_LATITUDE, 14.6760f), - sharedPref.getFloat(KEY_FAKE_LONGITUDE, 121.0437f) - ) - else null + var fakeLocation: Pair<Float, Float> + get() = Pair( + // Initial default value is Quezon City + sharedPref.getFloat(KEY_FAKE_LATITUDE, 14.6760f), + sharedPref.getFloat(KEY_FAKE_LONGITUDE, 121.0437f) + ) set(value) { - if (value == null) { - sharedPref.edit() - .putBoolean(KEY_FAKE_LOCATION, false) - .remove(KEY_FAKE_LATITUDE) - .remove(KEY_FAKE_LONGITUDE) - .commit() - } else { - sharedPref.edit() - .putBoolean(KEY_FAKE_LOCATION, true) - .putFloat(KEY_FAKE_LATITUDE, value.first) - .putFloat(KEY_FAKE_LONGITUDE, value.second) - .commit() - } + sharedPref.edit() + .putFloat(KEY_FAKE_LATITUDE, value.first) + .putFloat(KEY_FAKE_LONGITUDE, value.second) + .apply() } val locationMode: MutableStateFlow<LocationMode> = MutableStateFlow(LocationMode.REAL_LOCATION) - private val _ipScramblingSetting = MutableStateFlow(sharedPref.getBoolean(KEY_IP_SCRAMBLING, true)) + private val _ipScramblingSetting = MutableStateFlow(sharedPref.getBoolean(KEY_IP_SCRAMBLING, false)) val ipScramblingSetting = _ipScramblingSetting.asStateFlow() + fun isIpScramblingFirstActivation(enabled: Boolean): Boolean { + return enabled && !sharedPref.contains(KEY_IP_SCRAMBLING) + } + fun setIpScramblingSetting(enabled: Boolean) { set(KEY_IP_SCRAMBLING, enabled) _ipScramblingSetting.update { enabled } @@ -100,18 +89,17 @@ class LocalStateRepository(context: Context) { val internetPrivacyMode: MutableStateFlow<InternetPrivacyMode> = MutableStateFlow(InternetPrivacyMode.REAL_IP) - private val _showQuickPrivacyDisabledMessage = MutableStateFlow(false) - val showQuickPrivacyDisabledMessage: StateFlow<Boolean> = _showQuickPrivacyDisabledMessage - - fun setShowQuickPrivacyDisabledMessage(show: Boolean) { - _showQuickPrivacyDisabledMessage.value = show + private val _otherVpnRunning = MutableSharedFlow<ApplicationDescription>() + suspend fun emitOtherVpnRunning(appDesc: ApplicationDescription) { + _otherVpnRunning.emit(appDesc) } + val otherVpnRunning: SharedFlow<ApplicationDescription> = _otherVpnRunning var firstBoot: Boolean get() = sharedPref.getBoolean(KEY_FIRST_BOOT, true) set(value) = set(KEY_FIRST_BOOT, value) private fun set(key: String, value: Boolean) { - sharedPref.edit().putBoolean(key, value).commit() + sharedPref.edit().putBoolean(key, value).apply() } } diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/entities/InternetPrivacyMode.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/entities/InternetPrivacyMode.kt index 534bb2f..f849d57 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/entities/InternetPrivacyMode.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/entities/InternetPrivacyMode.kt @@ -21,5 +21,9 @@ enum class InternetPrivacyMode { REAL_IP, HIDE_IP, HIDE_IP_LOADING, - REAL_IP_LOADING + REAL_IP_LOADING; + + val isChecked get() = this == HIDE_IP || this == HIDE_IP_LOADING + + val isLoading get() = this == HIDE_IP_LOADING || this == REAL_IP_LOADING } diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt index e9da855..2910f26 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/FakeLocationStateUseCase.kt @@ -57,7 +57,7 @@ class FakeLocationStateUseCase( init { coroutineScope.launch { - localStateRepository.quickPrivacyEnabledFlow.collect { + localStateRepository.fakeLocationEnabled.collect { applySettings(it, localStateRepository.fakeLocation) } } @@ -71,10 +71,10 @@ class FakeLocationStateUseCase( permissionsModule.toggleDangerousPermission(appDesc, android.Manifest.permission.ACCESS_FINE_LOCATION, true) } - private fun applySettings(isQuickPrivacyEnabled: Boolean, fakeLocation: Pair<Float, Float>?, isSpecificLocation: Boolean = false) { - _configuredLocationMode.value = computeLocationMode(fakeLocation, isSpecificLocation) + private fun applySettings(isEnabled: Boolean, fakeLocation: Pair<Float, Float>, isSpecificLocation: Boolean = false) { + _configuredLocationMode.value = computeLocationMode(isEnabled, fakeLocation, isSpecificLocation) - if (isQuickPrivacyEnabled && fakeLocation != null && hasAcquireMockLocationPermission()) { + if (isEnabled && hasAcquireMockLocationPermission()) { fakeLocationModule.startFakeLocation() fakeLocationModule.setFakeLocation(fakeLocation.first.toDouble(), fakeLocation.second.toDouble()) localStateRepository.locationMode.value = configuredLocationMode.value.first @@ -90,18 +90,10 @@ class FakeLocationStateUseCase( } fun setSpecificLocation(latitude: Float, longitude: Float) { - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } - setFakeLocation(latitude to longitude, true) } fun setRandomLocation() { - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } - val randomIndex = Random.nextInt(citiesRepository.citiesLocationsList.size) val location = citiesRepository.citiesLocationsList[randomIndex] @@ -110,26 +102,29 @@ class FakeLocationStateUseCase( private fun setFakeLocation(location: Pair<Float, Float>, isSpecificLocation: Boolean = false) { localStateRepository.fakeLocation = location - applySettings(localStateRepository.isQuickPrivacyEnabled, location, isSpecificLocation) + localStateRepository.setFakeLocationEnabled(true) + applySettings(true, location, isSpecificLocation) } fun stopFakeLocation() { - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } - - localStateRepository.fakeLocation = null - applySettings(localStateRepository.isQuickPrivacyEnabled, null) + localStateRepository.setFakeLocationEnabled(false) + applySettings(false, localStateRepository.fakeLocation) } - private fun computeLocationMode(fakeLocation: Pair<Float, Float>?, isSpecificLocation: Boolean = false): Triple<LocationMode, Float?, Float?> { + private fun computeLocationMode( + isFakeLocationEnabled: Boolean, + fakeLocation: Pair<Float, Float>, + isSpecificLocation: Boolean = false, + ): Triple<LocationMode, Float?, Float?> { return Triple( when { - fakeLocation == null -> LocationMode.REAL_LOCATION - fakeLocation in citiesRepository.citiesLocationsList && !isSpecificLocation -> LocationMode.RANDOM_LOCATION + !isFakeLocationEnabled -> LocationMode.REAL_LOCATION + (fakeLocation in citiesRepository.citiesLocationsList && !isSpecificLocation) -> + LocationMode.RANDOM_LOCATION else -> LocationMode.SPECIFIC_LOCATION }, - fakeLocation?.first, fakeLocation?.second + fakeLocation.first, + fakeLocation.second ) } diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt index 46e054e..85410d0 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/GetQuickPrivacyStateUseCase.kt @@ -23,88 +23,69 @@ import foundation.e.privacycentralapp.domain.entities.LocationMode import foundation.e.privacycentralapp.domain.entities.QuickPrivacyState import foundation.e.privacycentralapp.domain.entities.TrackerMode import foundation.e.privacymodules.permissions.data.ApplicationDescription -import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.SharedFlow import kotlinx.coroutines.flow.StateFlow import kotlinx.coroutines.flow.combine -import kotlinx.coroutines.launch +import kotlinx.coroutines.flow.map class GetQuickPrivacyStateUseCase( - private val localStateRepository: LocalStateRepository, - coroutineScope: CoroutineScope + private val localStateRepository: LocalStateRepository ) { - - init { - coroutineScope.launch { - localStateRepository.quickPrivacyEnabledFlow.collect { - if (it) resetQuickPrivacyDisabledMessage() - } - } - } - - val quickPrivacyEnabledFlow: Flow<Boolean> = localStateRepository.quickPrivacyEnabledFlow - - val isQuickPrivacyEnabled: Boolean get() = localStateRepository.isQuickPrivacyEnabled - val quickPrivacyState: Flow<QuickPrivacyState> = combine( - localStateRepository.quickPrivacyEnabledFlow, + localStateRepository.blockTrackers, localStateRepository.areAllTrackersBlocked, localStateRepository.locationMode, localStateRepository.internetPrivacyMode - ) { isQuickPrivacyEnabled, isAllTrackersBlocked, locationMode, internetPrivacyMode -> + ) { isBlockTrackers, isAllTrackersBlocked, locationMode, internetPrivacyMode -> when { - !isQuickPrivacyEnabled -> QuickPrivacyState.DISABLED + !isBlockTrackers && + locationMode == LocationMode.REAL_LOCATION && + internetPrivacyMode == InternetPrivacyMode.REAL_IP -> QuickPrivacyState.DISABLED + isAllTrackersBlocked && locationMode != LocationMode.REAL_LOCATION && internetPrivacyMode in listOf( InternetPrivacyMode.HIDE_IP, InternetPrivacyMode.HIDE_IP_LOADING ) -> QuickPrivacyState.FULL_ENABLED + else -> QuickPrivacyState.ENABLED } } val trackerMode: Flow<TrackerMode> = combine( - localStateRepository.quickPrivacyEnabledFlow, + localStateRepository.blockTrackers, localStateRepository.areAllTrackersBlocked - ) { isQuickPrivacyEnabled, isAllTrackersBlocked -> + ) { isBlockTrackers, isAllTrackersBlocked -> when { - isQuickPrivacyEnabled && isAllTrackersBlocked -> TrackerMode.DENIED - isQuickPrivacyEnabled && !isAllTrackersBlocked -> TrackerMode.CUSTOM + isBlockTrackers && isAllTrackersBlocked -> TrackerMode.DENIED + isBlockTrackers && !isAllTrackersBlocked -> TrackerMode.CUSTOM else -> TrackerMode.VULNERABLE } } - val isLocationHidden: Flow<Boolean> = combine( - localStateRepository.quickPrivacyEnabledFlow, - localStateRepository.locationMode - ) { isQuickPrivacyEnabled, locationMode -> - isQuickPrivacyEnabled && locationMode != LocationMode.REAL_LOCATION + val isLocationHidden: Flow<Boolean> = localStateRepository.locationMode.map { locationMode -> + locationMode != LocationMode.REAL_LOCATION } val locationMode: StateFlow<LocationMode> = localStateRepository.locationMode - val isIpHidden: Flow<Boolean?> = combine( - localStateRepository.quickPrivacyEnabledFlow, - localStateRepository.internetPrivacyMode - ) { isQuickPrivacyEnabled, internetPrivacyMode -> - when { - !isQuickPrivacyEnabled || internetPrivacyMode == InternetPrivacyMode.REAL_IP -> false - internetPrivacyMode == InternetPrivacyMode.HIDE_IP -> true - else -> null - } - } + val ipScramblingMode: Flow<InternetPrivacyMode> = localStateRepository.internetPrivacyMode - fun toggleReturnIsFirstActivation(): Boolean { - val newState = !localStateRepository.isQuickPrivacyEnabled - return localStateRepository.setQuickPrivacyReturnIsFirstActivation(newState) + fun toggleTrackers() { + localStateRepository.setBlockTrackers(!localStateRepository.blockTrackers.value) } - val showQuickPrivacyDisabledMessage: StateFlow<Boolean> = localStateRepository.showQuickPrivacyDisabledMessage + fun toggleLocation() { + localStateRepository.setFakeLocationEnabled(!localStateRepository.fakeLocationEnabled.value) + } - fun resetQuickPrivacyDisabledMessage() { - localStateRepository.setShowQuickPrivacyDisabledMessage(false) + fun toggleIpScramblingIsFirstActivation(): Boolean { + val enabled = !localStateRepository.ipScramblingSetting.value + val firstActivation = localStateRepository.isIpScramblingFirstActivation(enabled) + localStateRepository.setIpScramblingSetting(enabled) + return firstActivation } val otherVpnRunning: SharedFlow<ApplicationDescription> = localStateRepository.otherVpnRunning 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 cb9fcd5..9216233 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 @@ -28,6 +28,7 @@ import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule import foundation.e.privacymodules.permissions.IPermissionsPrivacyModule import foundation.e.privacymodules.permissions.data.ApplicationDescription import kotlinx.coroutines.CoroutineScope +import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.channels.awaitClose import kotlinx.coroutines.flow.SharingStarted import kotlinx.coroutines.flow.StateFlow @@ -43,9 +44,6 @@ class IpScramblingStateUseCase( private val appListsRepository: AppListsRepository, private val coroutineScope: CoroutineScope ) { - - val configuredMode: StateFlow<Boolean> = localStateRepository.ipScramblingSetting - val internetPrivacyMode: StateFlow<InternetPrivacyMode> = callbackFlow { val listener = object : IIpScramblerModule.Listener { override fun onStatusChanged(newStatus: IIpScramblerModule.Status) { @@ -67,13 +65,13 @@ class IpScramblingStateUseCase( }.stateIn( scope = coroutineScope, started = SharingStarted.Eagerly, - initialValue = InternetPrivacyMode.REAL_IP + initialValue = REAL_IP ) init { - coroutineScope.launch { - localStateRepository.quickPrivacyEnabledFlow.collect { - applySettings(it, localStateRepository.ipScramblingSetting.value) + coroutineScope.launch(Dispatchers.Default) { + localStateRepository.ipScramblingSetting.collect { + applySettings(it) } } @@ -84,12 +82,7 @@ class IpScramblingStateUseCase( fun toggle(hideIp: Boolean) { localStateRepository.setIpScramblingSetting(enabled = hideIp) - - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } else { - applySettings(true, hideIp) - } + applySettings(hideIp) } private fun getHiddenPackageNames(): List<String> { @@ -129,15 +122,13 @@ class IpScramblingStateUseCase( ipScramblerModule.appList = rawList } - private fun applySettings(isQuickPrivacyEnabled: Boolean, isIpScramblingEnabled: Boolean) { - val settingEnabled = isQuickPrivacyEnabled && isIpScramblingEnabled + private fun applySettings(isIpScramblingEnabled: Boolean) { val currentMode = localStateRepository.internetPrivacyMode.value - when { - settingEnabled && currentMode in setOf(REAL_IP, REAL_IP_LOADING) -> + isIpScramblingEnabled && currentMode in setOf(REAL_IP, REAL_IP_LOADING) -> applyStartIpScrambling() - !settingEnabled && currentMode in setOf(HIDE_IP, HIDE_IP_LOADING) -> + !isIpScramblingEnabled && currentMode in setOf(HIDE_IP, HIDE_IP_LOADING) -> ipScramblerModule.stop() else -> {} @@ -162,11 +153,11 @@ class IpScramblingStateUseCase( private fun map(status: IIpScramblerModule.Status): InternetPrivacyMode { return when (status) { - IIpScramblerModule.Status.OFF -> InternetPrivacyMode.REAL_IP - IIpScramblerModule.Status.ON -> InternetPrivacyMode.HIDE_IP - IIpScramblerModule.Status.STARTING -> InternetPrivacyMode.HIDE_IP_LOADING + IIpScramblerModule.Status.OFF -> REAL_IP + IIpScramblerModule.Status.ON -> HIDE_IP + IIpScramblerModule.Status.STARTING -> HIDE_IP_LOADING IIpScramblerModule.Status.STOPPING, - IIpScramblerModule.Status.START_DISABLED -> InternetPrivacyMode.REAL_IP_LOADING + IIpScramblerModule.Status.START_DISABLED -> REAL_IP_LOADING } } } diff --git a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStateUseCase.kt b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStateUseCase.kt index 17e5096..8b37152 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStateUseCase.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/domain/usecases/TrackersStateUseCase.kt @@ -38,7 +38,7 @@ class TrackersStateUseCase( init { trackersPrivacyModule.start(trackersRepository.trackers, enableNotification = false) coroutineScope.launch { - localStateRepository.quickPrivacyEnabledFlow.collect { enabled -> + localStateRepository.blockTrackers.collect { enabled -> if (enabled) { blockTrackersPrivacyModule.enableBlocking() } else { @@ -76,10 +76,6 @@ class TrackersStateUseCase( } fun toggleAppWhitelist(appUid: Int, isWhitelisted: Boolean) { - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } - if (appUid == appListsRepository.dummySystemApp.uid) { appListsRepository.getHiddenSystemApps().forEach { blockTrackersPrivacyModule.setWhiteListed(it.uid, isWhitelisted) @@ -90,9 +86,6 @@ class TrackersStateUseCase( } fun blockTracker(appUid: Int, tracker: Tracker, isBlocked: Boolean) { - if (!localStateRepository.isQuickPrivacyEnabled) { - localStateRepository.setShowQuickPrivacyDisabledMessage(true) - } if (appUid == appListsRepository.dummySystemApp.uid) { appListsRepository.getHiddenSystemApps().forEach { |