Skip to content

Commit a3a7ba0

Browse files
authored
Ship VPN exclude app prompt (#5028)
Task/Issue URL: https://app.asana.com/0/1142021229838617/1208316612251365/f ### Description Enable the exclude app prompt shown everytime the VPN is attempted to be disabled by the user. ### Steps to test this PR https://app.asana.com/0/1142021229838617/1208233455261636/f
1 parent 78ae550 commit a3a7ba0

File tree

4 files changed

+20
-17
lines changed

4 files changed

+20
-17
lines changed

network-protection/network-protection-impl/src/main/java/com/duckduckgo/networkprotection/impl/VpnRemoteFeatures.kt

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ import com.duckduckgo.di.scopes.AppScope
2626
import com.duckduckgo.feature.toggles.api.RemoteFeatureStoreNamed
2727
import com.duckduckgo.feature.toggles.api.Toggle
2828
import com.duckduckgo.feature.toggles.api.Toggle.DefaultValue
29-
import com.duckduckgo.feature.toggles.api.Toggle.InternalAlwaysEnabled
3029
import com.duckduckgo.feature.toggles.api.Toggle.State
3130
import com.squareup.anvil.annotations.ContributesBinding
3231
import com.squareup.moshi.JsonAdapter
@@ -46,8 +45,7 @@ interface VpnRemoteFeatures {
4645
@Toggle.DefaultValue(true)
4746
fun self(): Toggle
4847

49-
@DefaultValue(false)
50-
@InternalAlwaysEnabled
48+
@DefaultValue(true)
5149
fun showExcludeAppPrompt(): Toggle // kill switch
5250
}
5351

network-protection/network-protection-impl/src/main/res/layout/dialog_vpn_disable.xml

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -42,24 +42,24 @@
4242
app:textType="secondary"
4343
app:typography="body1" />
4444

45+
<CheckBox
46+
android:id="@+id/vpnDontShowAgainMessage"
47+
android:layout_width="match_parent"
48+
android:layout_height="wrap_content"
49+
android:layout_marginTop="@dimen/keyline_2"
50+
android:checked="false"
51+
android:orientation="horizontal"
52+
android:text="@string/netpManagementExcludeAppPromptActionDisablePermanent"
53+
app:layout_constraintTop_toBottomOf="@+id/vpnExcludeAppPromptMessage" />
54+
4555
<LinearLayout
4656
android:id="@+id/vpnExcludeAppPromptDialogButtonLayout"
4757
android:layout_width="0dp"
4858
android:layout_height="wrap_content"
49-
android:layout_marginTop="@dimen/keyline_4"
5059
android:gravity="end"
5160
android:orientation="vertical"
5261
app:layout_constraintEnd_toEndOf="parent"
5362
app:layout_constraintStart_toStartOf="parent"
54-
app:layout_constraintTop_toBottomOf="@+id/vpnExcludeAppPromptMessage" />
55-
56-
<CheckBox
57-
android:id="@+id/vpnDontShowAgainMessage"
58-
android:layout_width="match_parent"
59-
android:layout_height="wrap_content"
60-
android:checked="false"
61-
android:orientation="horizontal"
62-
android:text="@string/netpManagementExcludeAppPromptActionDisablePermanent"
63-
app:layout_constraintTop_toBottomOf="@+id/vpnExcludeAppPromptDialogButtonLayout" />
63+
app:layout_constraintTop_toBottomOf="@+id/vpnDontShowAgainMessage" />
6464

6565
</androidx.constraintlayout.widget.ConstraintLayout>

network-protection/network-protection-impl/src/main/res/values/donottranslate.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,11 +28,11 @@
2828
<string name="netpManagementBetaDescription">DuckDuckGo VPN is currently in beta. <annotation type="report_issues_link">Share feedback</annotation> to help us improve!</string>
2929

3030
<!-- Exclude App Prompt -->
31-
<string name="netpManagementExcludeAppPromptTitle">App not working?</string>
32-
<string name="netpManagementExcludeAppPromptSubtitle">If an app isn\'t working while the VPN is on, you can exclude that app from the VPN without turning the VPN off.</string>
31+
<string name="netpManagementExcludeAppPromptTitle">Is the VPN causing problems with an app?</string>
32+
<string name="netpManagementExcludeAppPromptSubtitle">You can exclude apps from the VPN without turning the VPN off.</string>
3333
<string name="netpManagementExcludeAppPromptActionDisableOne">Exclude an app</string>
3434
<string name="netpManagementExcludeAppPromptActionDisableAll">Turn off VPN</string>
35-
<string name="netpManagementExcludeAppPromptActionDisablePermanent">Don\'t ask again</string>
35+
<string name="netpManagementExcludeAppPromptActionDisablePermanent">Never ask again</string>
3636

3737
<!-- Location -->
3838
<string name="netpManagementLocationHeaderVpnOff">Selected Location</string>

network-protection/network-protection-impl/src/test/java/com/duckduckgo/networkprotection/impl/management/NetworkProtectionManagementViewModelTest.kt

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616

1717
package com.duckduckgo.networkprotection.impl.management
1818

19+
import android.annotation.SuppressLint
1920
import android.content.Intent
2021
import androidx.lifecycle.LifecycleOwner
2122
import app.cash.turbine.test
@@ -195,8 +196,10 @@ class NetworkProtectionManagementViewModelTest {
195196
verify(networkProtectionState).start()
196197
}
197198

199+
@SuppressLint("DenyListedApi")
198200
@Test
199201
fun whenOnNetpToggleClickedToDisabledThenUnregisterFeature() = runTest {
202+
vpnRemoteFeatures.showExcludeAppPrompt().setEnabled(Toggle.State(enable = false))
200203
testee.onNetpToggleClicked(false)
201204

202205
verify(networkProtectionState).clearVPNConfigurationAndStop()
@@ -578,6 +581,7 @@ class NetworkProtectionManagementViewModelTest {
578581
}
579582
}
580583

584+
@SuppressLint("DenyListedApi")
581585
@Test
582586
fun whenExcludeAppPromptEnabledAndToggleTurnedOffThenShowPrompt() = runTest {
583587
vpnRemoteFeatures.showExcludeAppPrompt().setEnabled(Toggle.State(enable = true))
@@ -595,6 +599,7 @@ class NetworkProtectionManagementViewModelTest {
595599
}
596600
}
597601

602+
@SuppressLint("DenyListedApi")
598603
@Test
599604
fun whenPermanentDisableExcludeAppPromptThenDontShowPrompt() = runTest {
600605
vpnRemoteFeatures.showExcludeAppPrompt().setEnabled(Toggle.State(enable = true))

0 commit comments

Comments
 (0)