diff options
author | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-11-28 18:35:45 +0100 |
---|---|---|
committer | Guillaume Jacquart <guillaume.jacquart-ext@mousquetaires.com> | 2022-11-28 18:42:54 +0100 |
commit | cde9ed0b42898f9f87004dda337b9ce7cf46d3cf (patch) | |
tree | c36759a313267b950be2fc72227e1051a1fecf91 /app/src/main/java | |
parent | 2f40c62572be0fffa04fe6cf105ece937389e287 (diff) |
5903: move ipscrambling speed message to warning dialog.
Diffstat (limited to 'app/src/main/java')
4 files changed, 4 insertions, 31 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 6cb4f81..ed97c94 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 @@ -81,10 +81,6 @@ class LocalStateRepository(context: Context) { 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 } 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 85410d0..e2c0e7f 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 @@ -81,11 +81,8 @@ class GetQuickPrivacyStateUseCase( localStateRepository.setFakeLocationEnabled(!localStateRepository.fakeLocationEnabled.value) } - fun toggleIpScramblingIsFirstActivation(): Boolean { - val enabled = !localStateRepository.ipScramblingSetting.value - val firstActivation = localStateRepository.isIpScramblingFirstActivation(enabled) - localStateRepository.setIpScramblingSetting(enabled) - return firstActivation + fun toggleIpScrambling() { + localStateRepository.setIpScramblingSetting(!localStateRepository.ipScramblingSetting.value) } val otherVpnRunning: SharedFlow<ApplicationDescription> = localStateRepository.otherVpnRunning diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardViewModel.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardViewModel.kt index 57e7790..18b4212 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardViewModel.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardViewModel.kt @@ -94,7 +94,7 @@ class DashboardViewModel( fetchStatistics().first() } is Action.ToggleLocation -> getPrivacyStateUseCase.toggleLocation() - is Action.ToggleIpScrambling -> actionToggleIpScrambling() + is Action.ToggleIpScrambling -> getPrivacyStateUseCase.toggleIpScrambling() is Action.ShowFakeMyLocationAction -> _singleEvents.emit(SingleEvent.NavigateToLocationSingleEvent) is Action.ShowAppsPermissions -> @@ -123,16 +123,6 @@ class DashboardViewModel( } } - private suspend fun actionToggleIpScrambling() = withContext(Dispatchers.IO) { - val isFirstActivation = getPrivacyStateUseCase.toggleIpScramblingIsFirstActivation() - - if (isFirstActivation) _singleEvents.emit( - SingleEvent.ToastMessageSingleEvent( - message = R.string.dashboard_first_ipscrambling_activation - ) - ) - } - private suspend fun actionShowMostLeakedApp() = withContext(Dispatchers.IO) { _singleEvents.emit( trackersStatisticsUseCase.getMostLeakedApp()?.let { diff --git a/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt b/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt index 4a103e0..e01f47f 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/widget/WidgetCommandReceiver.kt @@ -20,9 +20,7 @@ package foundation.e.privacycentralapp.widget import android.content.BroadcastReceiver import android.content.Context import android.content.Intent -import android.widget.Toast import foundation.e.privacycentralapp.PrivacyCentralApplication -import foundation.e.privacycentralapp.R class WidgetCommandReceiver : BroadcastReceiver() { override fun onReceive(context: Context?, intent: Intent?) { @@ -31,15 +29,7 @@ class WidgetCommandReceiver : BroadcastReceiver() { when (intent?.action) { ACTION_TOGGLE_TRACKERS -> getQuickPrivacyStateUseCase?.toggleTrackers() ACTION_TOGGLE_LOCATION -> getQuickPrivacyStateUseCase?.toggleLocation() - ACTION_TOGGLE_IPSCRAMBLING -> { - if (getQuickPrivacyStateUseCase?.toggleIpScramblingIsFirstActivation() == true) { - Toast.makeText( - context, - context.getString(R.string.dashboard_first_ipscrambling_activation), - Toast.LENGTH_LONG - ).show() - } - } + ACTION_TOGGLE_IPSCRAMBLING -> getQuickPrivacyStateUseCase?.toggleIpScrambling() else -> {} } } |