Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert and rename the auto connect option on non tv devices #5945

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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)
}
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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))
Expand Down
2 changes: 2 additions & 0 deletions android/lib/resource/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
6 changes: 6 additions & 0 deletions gui/locales/messages.pot
Original file line number Diff line number Diff line change
Expand Up @@ -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 ""

Expand Down Expand Up @@ -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 ""

Expand Down
Loading