From cde9ed0b42898f9f87004dda337b9ce7cf46d3cf Mon Sep 17 00:00:00 2001 From: Guillaume Jacquart Date: Mon, 28 Nov 2022 18:35:45 +0100 Subject: [PATCH] 5903: move ipscrambling speed message to warning dialog. --- .../data/repositories/LocalStateRepository.kt | 4 ---- .../domain/usecases/GetQuickPrivacyStateUseCase.kt | 7 ++----- .../features/dashboard/DashboardViewModel.kt | 12 +----------- .../widget/WidgetCommandReceiver.kt | 12 +----------- app/src/main/res/values-de/strings.xml | 1 - app/src/main/res/values-fi/strings.xml | 1 - app/src/main/res/values-fr/strings.xml | 1 - app/src/main/res/values-it/strings.xml | 1 - app/src/main/res/values/strings.xml | 3 +-- 9 files changed, 5 insertions(+), 37 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 6cb4f814..ed97c947 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 85410d00..e2c0e7fb 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 = 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 57e77908..18b4212c 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 4a103e03..e01f47ff 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 -> {} } } diff --git a/app/src/main/res/values-de/strings.xml b/app/src/main/res/values-de/strings.xml index 75e3ce4c..fc067de5 100644 --- a/app/src/main/res/values-de/strings.xml +++ b/app/src/main/res/values-de/strings.xml @@ -78,7 +78,6 @@ Tippe, um herauszufinden, wie Tracker einfach blockiert, dein Standort gefälscht und deine IP-Adresse verschleiert werden kann. Benutzerdefinierte Datenschutz-Einstellungen werden angewendet Schließen - Das Verschleiern deiner IP wird möglicherweise die Internetgeschwindigkeit verlangsamen. Benutzerdefinierte Datenschutz-Einstellungen werden angewandt Ansicht Ansicht diff --git a/app/src/main/res/values-fi/strings.xml b/app/src/main/res/values-fi/strings.xml index 3b9a53fd..68d8d01f 100644 --- a/app/src/main/res/values-fi/strings.xml +++ b/app/src/main/res/values-fi/strings.xml @@ -50,7 +50,6 @@ Hallitse sovellusten käyttöoikeuksia %1$d sovellus seurainta, %2$d sallittua seurainta Hallitse sovellusten seuraimia - Kun IP-osoitteesi on väärennetty, Internetyhteytesi nopeus todennäköisesti heikkenee. Näytä %s seurainta on profiloinut tietojasi viimeisen 24 tunnin aikana Tänään diff --git a/app/src/main/res/values-fr/strings.xml b/app/src/main/res/values-fr/strings.xml index fdd84685..b884e5b0 100644 --- a/app/src/main/res/values-fr/strings.xml +++ b/app/src/main/res/values-fr/strings.xml @@ -66,7 +66,6 @@ \n \n\"Gérer ma position\" vous permet d\'utiliser une fausse position au lieu de votre position réelle. De cette façon, votre localisation réelle n\'est pas partagé avec des applications qui pourraient vous espionner. Les pisteurs sont des morceaux de code cachés dans les applications. Ils collectent vos données et suivent votre activité 24h/24 et 7j/7. Découvrez les pisteurs actifs et bloquez-les tous pour une meilleure protection. Pour éviter le dysfonctionnement de certaines applications, vous pouvez également choisir spécifiquement les pisteurs que vous souhaitez bloquer. - Votre vitesse Internet risque d\'être réduite tant que votre adresse IP est masquée. Fuites autorisées Fuites bloquées Appuyez sur les barres pour plus d\'informations. diff --git a/app/src/main/res/values-it/strings.xml b/app/src/main/res/values-it/strings.xml index ee233274..2c44ff29 100644 --- a/app/src/main/res/values-it/strings.xml +++ b/app/src/main/res/values-it/strings.xml @@ -73,7 +73,6 @@ La tua privavy online non è protetta La tua privacy online è protetta App non installata. - Mentre l\'indirizzo IP è nascosto, la velocità su Internet risulta rallentata. Guarda Impostazioni della privacy personalizzate applicate Chiudi diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b1d241d0..4d6e1f94 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -30,7 +30,6 @@ Today %s trackers have profiled you in the last 24 hours View - While your IP is faked, your Internet speed is likely to be reduced. Manage apps\' trackers %1$d detected trackers, %2$d allowed trackers Manage apps\' permissions @@ -100,7 +99,7 @@ Fake my location While this option is active, some apps that rely on your real location may not work properly. It\'s recommended to enable it only occasionally, only when needed. Hide my IP - This option uses the TOR network to hide your real IP address. Only use it for specific applications. Important: we advise disabling this feature for email services as your address may end into permanent ban from your provider. + This option uses the TOR network to hide your real IP address. Only use it for specific applications. While your IP is faked, your Internet speed is likely to be reduced.\nImportant: we advise disabling this feature for email services as your address may end into permanent ban from your provider. I understand -- GitLab