From 3d1fc33d453f49ca14bce76565ac93d8c6690ae8 Mon Sep 17 00:00:00 2001 From: jacquarg Date: Tue, 1 Mar 2022 21:29:18 +0100 Subject: Warning message when enabling Tor is long. #4610 --- .../features/dashboard/DashboardFragment.kt | 2 ++ .../internetprivacy/InternetPrivacyFeature.kt | 22 ++++++++++++++++++---- .../internetprivacy/InternetPrivacyFragment.kt | 2 ++ .../internetprivacy/InternetPrivacyViewModel.kt | 3 ++- .../e/privacycentralapp/main/MainActivity.kt | 2 ++ app/src/main/res/values/strings.xml | 1 + 6 files changed, 27 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt index e60243d..89f0dd1 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt @@ -39,9 +39,11 @@ import foundation.e.privacycentralapp.features.dashboard.DashboardFeature.State import foundation.e.privacycentralapp.features.internetprivacy.InternetPrivacyFragment import foundation.e.privacycentralapp.features.location.FakeLocationFragment import foundation.e.privacycentralapp.features.trackers.TrackersFragment +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect +@FlowPreview class DashboardFragment : NavToolbarFragment(R.layout.fragment_dashboard), MVIView { diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFeature.kt b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFeature.kt index 8d50980..eca1578 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFeature.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFeature.kt @@ -33,7 +33,9 @@ import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule import foundation.e.privacymodules.permissions.data.ApplicationDescription import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.flowOf import kotlinx.coroutines.flow.flowOn import kotlinx.coroutines.flow.map @@ -96,10 +98,13 @@ class InternetPrivacyFeature( val bypassTorApps: Collection ) : Effect() data class LocationSelectedEffect(val locationId: String) : Effect() + object WarningStartingLongEffect : Effect() data class ErrorEffect(val message: String) : Effect() } companion object { + private const val WARNING_LOADING_LONG_DELAY = 5 * 1000L + @FlowPreview fun create( coroutineScope: CoroutineScope, ipScramblerModule: IIpScramblerModule, @@ -132,15 +137,22 @@ class InternetPrivacyFeature( actor = { state, action -> when { action is Action.LoadInternetModeAction -> merge( - getQuickPrivacyStateUseCase.quickPrivacyEnabledFlow.map { Effect.QuickPrivacyUpdatedEffect(it) }, - ipScramblingStateUseCase.internetPrivacyMode.map { Effect.ModeUpdatedEffect(it) }.shareIn(scope = coroutineScope, started = SharingStarted.Lazily, replay = 0), + getQuickPrivacyStateUseCase.quickPrivacyEnabledFlow + .map { Effect.QuickPrivacyUpdatedEffect(it) }, + ipScramblingStateUseCase.internetPrivacyMode + .map { Effect.ModeUpdatedEffect(it) } + .shareIn(scope = coroutineScope, started = SharingStarted.Lazily, replay = 0), appListUseCase.getAppsUsingInternet().map { apps -> Effect.AvailableAppsListEffect( apps, ipScramblingStateUseCase.bypassTorApps ) }, - flowOf(Effect.LocationSelectedEffect(ipScramblerModule.exitCountry)) + flowOf(Effect.LocationSelectedEffect(ipScramblerModule.exitCountry)), + ipScramblingStateUseCase.internetPrivacyMode + .map { it == InternetPrivacyMode.HIDE_IP_LOADING } + .debounce(WARNING_LOADING_LONG_DELAY) + .map { if (it) Effect.WarningStartingLongEffect else Effect.NoEffect } ).flowOn(Dispatchers.Default) action is Action.AndroidVpnActivityResultAction -> if (action.resultCode == Activity.RESULT_OK) { @@ -202,7 +214,9 @@ class InternetPrivacyFeature( singleEventProducer = { _, action, effect -> when { effect is Effect.ErrorEffect -> SingleEvent.ErrorEvent(effect.message) - effect == Effect.QuickPrivacyDisabledWarningEffect -> SingleEvent.ErrorEvent(error = R.string.ipscrambling_error_quickprivacy_disabled) + effect is Effect.WarningStartingLongEffect -> + SingleEvent.ErrorEvent(R.string.ipscrambling_warning_starting_long) + effect is Effect.QuickPrivacyDisabledWarningEffect -> SingleEvent.ErrorEvent(error = R.string.ipscrambling_error_quickprivacy_disabled) action is Action.UseHiddenIPAction && effect is Effect.ShowAndroidVpnDisclaimerEffect -> diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt index 07e0627..f49399f 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyFragment.kt @@ -36,10 +36,12 @@ import foundation.e.privacycentralapp.databinding.FragmentInternetActivityPolicy import foundation.e.privacycentralapp.domain.entities.InternetPrivacyMode import foundation.e.privacycentralapp.extensions.toText import foundation.e.privacycentralapp.extensions.viewModelProviderFactoryOf +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.Flow import kotlinx.coroutines.flow.collect import java.util.Locale +@FlowPreview class InternetPrivacyFragment : NavToolbarFragment(R.layout.fragment_internet_activity_policy), MVIView { diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyViewModel.kt b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyViewModel.kt index 08da69e..8bb7d9f 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyViewModel.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/internetprivacy/InternetPrivacyViewModel.kt @@ -24,6 +24,7 @@ import foundation.e.privacycentralapp.domain.usecases.AppListUseCase import foundation.e.privacycentralapp.domain.usecases.GetQuickPrivacyStateUseCase import foundation.e.privacycentralapp.domain.usecases.IpScramblingStateUseCase import foundation.e.privacymodules.ipscramblermodule.IIpScramblerModule +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.flow.MutableSharedFlow import kotlinx.coroutines.flow.asSharedFlow import kotlinx.coroutines.launch @@ -40,7 +41,7 @@ class InternetPrivacyViewModel( val availablesLocationsIds = listOf("", *ipScramblerModule.getAvailablesLocations().sorted().toTypedArray()) - val internetPrivacyFeature: InternetPrivacyFeature by lazy { + @FlowPreview val internetPrivacyFeature: InternetPrivacyFeature by lazy { InternetPrivacyFeature.create( coroutineScope = viewModelScope, ipScramblerModule = ipScramblerModule, diff --git a/app/src/main/java/foundation/e/privacycentralapp/main/MainActivity.kt b/app/src/main/java/foundation/e/privacycentralapp/main/MainActivity.kt index 1b92cb2..c0bdcf0 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/main/MainActivity.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/main/MainActivity.kt @@ -25,7 +25,9 @@ import androidx.fragment.app.add import androidx.fragment.app.commit import foundation.e.privacycentralapp.R import foundation.e.privacycentralapp.features.dashboard.DashboardFragment +import kotlinx.coroutines.FlowPreview +@FlowPreview open class MainActivity : FragmentActivity(R.layout.activity_main) { override fun onCreate(savedInstanceState: Bundle?) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 49b6c95..f63da8b 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -44,6 +44,7 @@ Random country Apply this setting to all selected apps: Enabled Quick Privacy to use functionalities + Our scrambling IP service is taking time to launch. It can take a few minutes. Leaving the screen won\'t interrupt the process. -- cgit v1.2.1 From 1ded1d534ca867daf0896e6419cb7de9a37bb446 Mon Sep 17 00:00:00 2001 From: jacquarg Date: Tue, 1 Mar 2022 22:43:56 +0100 Subject: Update wordings #4743 --- .../features/dashboard/DashboardFragment.kt | 2 +- app/src/main/res/layout/fragment_trackers.xml | 2 +- app/src/main/res/values/strings.xml | 47 +++++++++++----------- 3 files changed, 25 insertions(+), 26 deletions(-) diff --git a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt index 89f0dd1..db9dcce 100644 --- a/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt +++ b/app/src/main/java/foundation/e/privacycentralapp/features/dashboard/DashboardFragment.kt @@ -215,7 +215,7 @@ class DashboardFragment : if (state.activeTrackersCount != null && state.trackersCount != null) { binding.amITracked.subTitle = getString(R.string.dashboard_am_i_tracked_subtitle, state.trackersCount, state.activeTrackersCount) } else { - binding.amITracked.subTitle = getString(R.string.trackers_title) + binding.amITracked.subTitle = "" } binding.myLocation.subTitle = getString( diff --git a/app/src/main/res/layout/fragment_trackers.xml b/app/src/main/res/layout/fragment_trackers.xml index f04379e..599d68d 100644 --- a/app/src/main/res/layout/fragment_trackers.xml +++ b/app/src/main/res/layout/fragment_trackers.xml @@ -33,7 +33,7 @@ android:layout_width="match_parent" android:paddingTop="16dp" android:lineSpacingExtra="5sp" - android:text="@string/manage_trackers_info" + android:text="@string/trackers_info" /> Quick Privacy - Your online privacy is not protected - Your online privacy is now protected! + You are not protected against tracking and surveillance + You are protected against tracking and surveillance Tap to disable your privacy preferences Tap to enable your privacy preferences Trackers: Vulnerable Denied - Geolocation: + Location: Exposed Fake - IP address: + Real IP address: Exposed Hidden - Personal data leakage + Trackers\' activity Today %s Trackers - Manage trackers + Manage apps\' trackers %1$d app trackers, %2$d active trackers - Apps Permissions + Manage apps\' permissions Manage your permissions - Geolocation mode + Manage my location Real geolocation Specific fake geolocation Random fake geolocation - My internet activity privacy + Manage my Internet address Real IP address exposed Real IP address hidden - My internet activity - Choose if you want to expose your real IP address or hide when Quick Privacy is enabled. - Use real IP address + Manage my internet address + Your Internet address or IP address is the identifier assigned to your phone when connected to the Internet.\n\nManage my Internet address enables you to use a fake IP address instead of your real IP address. This way, your internet activity cannot be linked to your real IP address and to your device. + Use my real IP address I can be tracked by my IP address - Hide IP address + Hide my real IP address I am anonymous on the internet - Note: when active, this setting will slow down your Internet connectivity speed (uses the Tor network). + Note: While this option is active, your Internet speed is likely to be significantly reduced. My internet activity must appear from: Random country - Apply this setting to all selected apps: + Apply this setting to all selected applications: Enabled Quick Privacy to use functionalities Our scrambling IP service is taking time to launch. It can take a few minutes. Leaving the screen won\'t interrupt the process. - Fake my location - Choose if you want to use your real location when Quick Privacy is enabled. - Use real location - Use random plausible location - Use specific location + Manage my location + Your location can reveal a lot about yourself or your activities.\n\nManage my location enables you to use a fake location instead of your real position. This way, your real location isn\'t shared with applications that might be snooping too much. + Use my real location + Use a random plausible location + Use a specific location Longitude Latitude Invalid coordinates - Manage trackers - See tracker usage and which trackers are present in your apps. + Manage apps\' trackers + Trackers are pieces of code hidden within applications. They collect your data and follow your activity 24/7: it feels like your phone listens to you.\n\nYou can see how many trackers are active behind the scenes, and you can block all trackers for the best protection. As it could cause some applications to malfunction, you can also fine tune your setting and choose specifically which trackers you want to block. %d trackers 24 hours past month past year - Allow or deny trackers in apps + Manage trackers used in applications: HH:mm MMM d - EEE MMM yyyy @@ -108,7 +108,6 @@ Click to learn more Apps Permission Trackers - See trackers usage over time and manage trackers available in applications Following trackers are in use Enable or disable this tracker for the following apps Tracker -- cgit v1.2.1