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

Implement support for daita with multihop #7230

Merged
merged 5 commits into from
Dec 2, 2024
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
3 changes: 3 additions & 0 deletions android/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ Line wrap the file at 100 chars. Th
proxies. The access method is enabled by default.
- Add multihop which allows the routing of traffic through an entry and exit server, making it
harder to trace.
- Enable DAITA to route traffic through servers with DAITA support to enable the use
of all servers together with DAITA. This behaviour can be disabled with the use of the
"Direct only" setting.

### Changed
- Animation has been changed to look better with predictive back.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ class SettingsScreenTest {
isSupportedVersion = true,
isPlayBuild = false,
multihopEnabled = false,
isDaitaEnabled = false,
)
)
}
Expand All @@ -58,6 +59,7 @@ class SettingsScreenTest {
isSupportedVersion = true,
isPlayBuild = false,
multihopEnabled = false,
isDaitaEnabled = false,
)
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class SelectLocationScreenTest {
setContentWithTheme {
SelectLocationScreen(
state =
SelectLocationUiState(
SelectLocationUiState.Data(
// searchTerm = "",
filterChips = emptyList(),
multihopEnabled = false,
Expand Down Expand Up @@ -96,7 +96,7 @@ class SelectLocationScreenTest {
setContentWithTheme {
SelectLocationScreen(
state =
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips = emptyList(),
multihopEnabled = false,
relayListType = RelayListType.EXIT,
Expand Down Expand Up @@ -124,7 +124,7 @@ class SelectLocationScreenTest {
setContentWithTheme {
SelectLocationScreen(
state =
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips = emptyList(),
multihopEnabled = false,
relayListType = RelayListType.EXIT,
Expand Down Expand Up @@ -156,7 +156,7 @@ class SelectLocationScreenTest {
setContentWithTheme {
SelectLocationScreen(
state =
SelectLocationUiState(
SelectLocationUiState.Data(
// searchTerm = "",
filterChips = emptyList(),
multihopEnabled = false,
Expand Down Expand Up @@ -189,7 +189,7 @@ class SelectLocationScreenTest {
setContentWithTheme {
SelectLocationScreen(
state =
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips = emptyList(),
multihopEnabled = false,
relayListType = RelayListType.EXIT,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,5 @@ object ContentType {
const val SPACER = 5
const val PROGRESS = 6
const val EMPTY_TEXT = 7
const val BUTTON = 8
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package net.mullvad.mullvadvpn.compose.dialog

import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.height
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
Expand All @@ -18,34 +16,24 @@ import net.mullvad.mullvadvpn.R
import net.mullvad.mullvadvpn.compose.dialog.info.InfoConfirmationDialog
import net.mullvad.mullvadvpn.compose.dialog.info.InfoConfirmationDialogTitleType
import net.mullvad.mullvadvpn.lib.theme.AppTheme
import net.mullvad.mullvadvpn.lib.theme.Dimens

@Preview
@Composable
private fun PreviewDaitaConfirmationDialog() {
AppTheme { DaitaConfirmation(EmptyResultBackNavigator()) }
private fun PreviewDaitaDirectOnlyConfirmationDialog() {
AppTheme { DaitaDirectOnlyConfirmation(EmptyResultBackNavigator()) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun DaitaConfirmation(navigator: ResultBackNavigator<Boolean>) {
fun DaitaDirectOnlyConfirmation(navigator: ResultBackNavigator<Boolean>) {
InfoConfirmationDialog(
navigator = navigator,
titleType = InfoConfirmationDialogTitleType.IconOnly,
confirmButtonTitle = stringResource(R.string.enable_anyway),
cancelButtonTitle = stringResource(R.string.back),
confirmButtonTitle = stringResource(R.string.enable_direct_only),
cancelButtonTitle = stringResource(R.string.cancel),
) {
Text(
text = stringResource(id = R.string.daita_relay_subset_warning),
color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.fillMaxWidth(),
)

Spacer(modifier = Modifier.height(Dimens.verticalSpace))

Text(
text = stringResource(id = R.string.daita_warning, stringResource(id = R.string.daita)),
text = stringResource(id = R.string.direct_only_description),
color = MaterialTheme.colorScheme.onSurface,
style = MaterialTheme.typography.bodySmall,
modifier = Modifier.fillMaxWidth(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,15 @@ import net.mullvad.mullvadvpn.lib.theme.AppTheme

@Preview
@Composable
private fun PreviewDaitaInfoDialog() {
AppTheme { DaitaInfo(EmptyDestinationsNavigator) }
private fun PreviewDaitaDirectOnlyInfoDialog() {
AppTheme { DaitaDirectOnlyInfo(EmptyDestinationsNavigator) }
}

@Destination<RootGraph>(style = DestinationStyle.Dialog::class)
@Composable
fun DaitaInfo(navigator: DestinationsNavigator) {
fun DaitaDirectOnlyInfo(navigator: DestinationsNavigator) {
InfoDialog(
message =
stringResource(
id = R.string.daita_info,
stringResource(id = R.string.daita),
stringResource(id = R.string.daita_full),
),
additionalInfo =
stringResource(id = R.string.daita_warning, stringResource(id = R.string.daita)),
message = stringResource(id = R.string.daita_info),
onDismiss = dropUnlessResumed { navigator.navigateUp() },
)
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,13 @@ class SelectLocationsUiStatePreviewParameterProvider :
PreviewParameterProvider<SelectLocationUiState> {
override val values =
sequenceOf(
SelectLocationUiState(
SelectLocationUiState.Loading,
SelectLocationUiState.Data(
filterChips = emptyList(),
multihopEnabled = false,
relayListType = RelayListType.EXIT,
),
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips =
listOf(
FilterChip.Ownership(ownership = ModelOwnership.Rented),
Expand All @@ -26,12 +27,12 @@ class SelectLocationsUiStatePreviewParameterProvider :
multihopEnabled = false,
relayListType = RelayListType.EXIT,
),
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips = emptyList(),
multihopEnabled = true,
relayListType = RelayListType.ENTRY,
),
SelectLocationUiState(
SelectLocationUiState.Data(
filterChips =
listOf(
FilterChip.Ownership(ownership = ModelOwnership.MullvadOwned),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ class SettingsUiStatePreviewParameterProvider : PreviewParameterProvider<Setting
appVersion = "2222.22",
isLoggedIn = true,
isSupportedVersion = true,
isDaitaEnabled = true,
isPlayBuild = true,
multihopEnabled = false,
),
SettingsUiState(
appVersion = "9000.1",
isLoggedIn = false,
isSupportedVersion = false,
isDaitaEnabled = false,
isPlayBuild = false,
multihopEnabled = false,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ class VpnSettingsUiStatePreviewParameterProvider : PreviewParameterProvider<VpnS
VpnSettingsUiState.createDefault(
mtu = Mtu(MTU),
isLocalNetworkSharingEnabled = true,
isDaitaEnabled = true,
isCustomDnsEnabled = true,
customDnsItems = listOf(CustomDnsItem("0.0.0.0", false)),
contentBlockersOptions =
Expand Down
Loading
Loading