summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJonatan Rhodin <jonatan.rhodin@mullvad.net>2024-03-12 12:15:57 +0100
committerJonatan Rhodin <jonatan.rhodin@mullvad.net>2024-03-12 12:15:57 +0100
commitc9b0230d3780ef7944c257438eb749e32be6be62 (patch)
tree23ad4a3067d3f89b4a4dfde94f9d453345186262
parent09d7368937d8bcf6c20ce4dedcd7a69c03f61f1d (diff)
parent2dcc0f313db57785cafba47489cd01809207d47b (diff)
downloadmullvadvpn-c9b0230d3780ef7944c257438eb749e32be6be62.tar.xz
mullvadvpn-c9b0230d3780ef7944c257438eb749e32be6be62.zip
Merge branch 'revert-and-rename-the-auto-connect-option-on-non-tv-devices-droid-741'
-rw-r--r--CHANGELOG.md6
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt6
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt6
-rw-r--r--android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt52
-rw-r--r--android/lib/resource/src/main/res/values/strings.xml2
-rw-r--r--gui/locales/messages.pot6
6 files changed, 60 insertions, 18 deletions
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 28e5dc382d..c882837eff 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -30,8 +30,7 @@ Line wrap the file at 100 chars. Th
#### Android
- Add support for all screen orientations.
- Add toggle for enabling or disabling split tunneling.
-- Replace auto connect with auto connect and lockdown mode guide on platforms that has
- system vpn settings.
+- Add auto connect and lockdown mode guide on platforms that has system vpn settings.
- Add 3D map to Connect screen.
### Changed
@@ -40,7 +39,8 @@ Line wrap the file at 100 chars. Th
#### Android
- Migrate to Compose Navigation which also improves screen transition animations.
-- Increase focus highlight opacity
+- Increase focus highlight opacity.
+- Set auto-connect setting as legacy on platforms with system vpn settings.
### Fixed
- Continual excessive attempts to update the API IP were made after testing access methods.
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
index 13aaea4334..15f6e4d111 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/BaseCell.kt
@@ -19,6 +19,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.testTag
+import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.TextStyle
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.text.style.TextOverflow
@@ -109,6 +110,11 @@ internal fun BaseCellTitle(
@Composable
fun BaseSubtitleCell(text: String, modifier: Modifier = Modifier) {
+ BaseSubtitleCell(text = AnnotatedString(text), modifier = modifier)
+}
+
+@Composable
+fun BaseSubtitleCell(text: AnnotatedString, modifier: Modifier = Modifier) {
Text(
text = text,
style = MaterialTheme.typography.labelMedium,
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
index e7d6e7f1c3..6aeea8897d 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/SwitchComposeCell.kt
@@ -15,6 +15,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.focus.focusProperties
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.Dp
@@ -193,3 +194,8 @@ fun CustomDnsCellSubtitle(isCellClickable: Boolean, modifier: Modifier) {
fun SwitchComposeSubtitleCell(text: String, modifier: Modifier = Modifier) {
BaseSubtitleCell(text = text, modifier = modifier)
}
+
+@Composable
+fun SwitchComposeSubtitleCell(text: AnnotatedString, modifier: Modifier = Modifier) {
+ BaseSubtitleCell(text = text, modifier = modifier)
+}
diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt
index 0530cfb4ae..403b1bb57e 100644
--- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt
+++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/VpnSettingsScreen.kt
@@ -22,8 +22,10 @@ import androidx.compose.ui.graphics.Color
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.compose.ui.platform.testTag
import androidx.compose.ui.res.stringResource
+import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
+import androidx.core.text.HtmlCompat
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import androidx.lifecycle.compose.collectAsStateWithLifecycle
@@ -49,6 +51,7 @@ import net.mullvad.mullvadvpn.compose.cell.SelectableCell
import net.mullvad.mullvadvpn.compose.cell.SwitchComposeSubtitleCell
import net.mullvad.mullvadvpn.compose.component.NavigateBackIconButton
import net.mullvad.mullvadvpn.compose.component.ScaffoldWithMediumTopBar
+import net.mullvad.mullvadvpn.compose.component.textResource
import net.mullvad.mullvadvpn.compose.destinations.AutoConnectAndLockdownModeDestination
import net.mullvad.mullvadvpn.compose.destinations.ContentBlockersInfoDialogDestination
import net.mullvad.mullvadvpn.compose.destinations.CustomDnsInfoDialogDestination
@@ -65,6 +68,7 @@ import net.mullvad.mullvadvpn.compose.dialog.WireguardCustomPortNavArgs
import net.mullvad.mullvadvpn.compose.dialog.WireguardPortInfoDialogArgument
import net.mullvad.mullvadvpn.compose.extensions.itemWithDivider
import net.mullvad.mullvadvpn.compose.extensions.itemsIndexedWithDivider
+import net.mullvad.mullvadvpn.compose.extensions.toAnnotatedString
import net.mullvad.mullvadvpn.compose.state.VpnSettingsUiState
import net.mullvad.mullvadvpn.compose.test.LAZY_LIST_LAST_ITEM_TEST_TAG
import net.mullvad.mullvadvpn.compose.test.LAZY_LIST_QUANTUM_ITEM_OFF_TEST_TAG
@@ -305,21 +309,39 @@ fun VpnSettingsScreen(
text = stringResource(id = R.string.auto_connect_and_lockdown_mode_footer)
)
}
- } else {
- item {
- Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding))
- HeaderSwitchComposeCell(
- title = stringResource(R.string.auto_connect),
- isToggled = state.isAutoConnectEnabled,
- isEnabled = true,
- onCellClicked = { newValue -> onToggleAutoConnect(newValue) }
- )
- }
- item {
- SwitchComposeSubtitleCell(
- text = stringResource(id = R.string.auto_connect_footer)
- )
- }
+ }
+ item {
+ Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding))
+ HeaderSwitchComposeCell(
+ title =
+ stringResource(
+ if (state.systemVpnSettingsAvailable) {
+ R.string.auto_connect_legacy
+ } else {
+ R.string.auto_connect
+ }
+ ),
+ isToggled = state.isAutoConnectEnabled,
+ isEnabled = true,
+ onCellClicked = { newValue -> onToggleAutoConnect(newValue) }
+ )
+ }
+ item {
+ SwitchComposeSubtitleCell(
+ text =
+ HtmlCompat.fromHtml(
+ if (state.systemVpnSettingsAvailable) {
+ textResource(
+ R.string.auto_connect_footer_legacy,
+ textResource(R.string.auto_connect_and_lockdown_mode)
+ )
+ } else {
+ textResource(R.string.auto_connect_footer)
+ },
+ HtmlCompat.FROM_HTML_MODE_COMPACT
+ )
+ .toAnnotatedString(boldFontWeight = FontWeight.ExtraBold)
+ )
}
item {
Spacer(modifier = Modifier.height(Dimens.cellLabelVerticalPadding))
diff --git a/android/lib/resource/src/main/res/values/strings.xml b/android/lib/resource/src/main/res/values/strings.xml
index b163c9f612..4400250dbc 100644
--- a/android/lib/resource/src/main/res/values/strings.xml
+++ b/android/lib/resource/src/main/res/values/strings.xml
@@ -280,4 +280,6 @@
<string name="loading_verifying">Verifying purchase...</string>
<string name="copied_logs_to_clipboard">Copied logs to clipboard</string>
<string name="split_tunneling_disabled_description">Split tunneling is disabled.</string>
+ <string name="auto_connect_legacy">Auto-connect (legacy)</string>
+ <string name="auto_connect_footer_legacy"><![CDATA[Please use the <b>Always-on</b> system setting instead by following the guide in <b>%s</b> above.]]></string>
</resources>
diff --git a/gui/locales/messages.pot b/gui/locales/messages.pot
index ccd498d2c3..4679499198 100644
--- a/gui/locales/messages.pot
+++ b/gui/locales/messages.pot
@@ -2061,6 +2061,9 @@ msgstr ""
msgid "Auto-connect & \\nLockdown mode"
msgstr ""
+msgid "Auto-connect (legacy)"
+msgstr ""
+
msgid "Auto-connect is called Always-on VPN in the Android system settings and it makes sure you are constantly connected to the VPN tunnel and auto connects after restart."
msgstr ""
@@ -2136,6 +2139,9 @@ msgstr ""
msgid "No internet connection"
msgstr ""
+msgid "Please use the <b>Always-on</b> system setting instead by following the guide in <b>%s</b> above."
+msgstr ""
+
msgid "Preferences"
msgstr ""