Skip to content

Commit

Permalink
Fixes based on feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
Pururun committed Nov 27, 2024
1 parent 00a8e02 commit 477c4ea
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fun Daita(
DaitaScreen(
state = state,
onDaitaEnabled = viewModel::setDaita,
onDirectOnly = { enable ->
onDirectOnlyClick = { enable ->
if (enable) {
navigator.navigate(DaitaDirectOnlyConfirmationDestination)
} else {
Expand All @@ -88,7 +88,7 @@ fun Daita(
fun DaitaScreen(
state: DaitaUiState,
onDaitaEnabled: (enable: Boolean) -> Unit = {},
onDirectOnly: (enable: Boolean) -> Unit = {},
onDirectOnlyClick: (enable: Boolean) -> Unit = {},
onDirectOnlyInfoClick: () -> Unit = {},
onBackClick: () -> Unit = {},
) {
Expand All @@ -110,7 +110,7 @@ fun DaitaScreen(
title = stringResource(R.string.direct_only),
isToggled = state.directOnly,
isEnabled = state.daitaEnabled,
onCellClicked = onDirectOnly,
onCellClicked = onDirectOnlyClick,
onInfoClicked = onDirectOnlyInfoClick,
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class FilterChipUseCase(
selectedOwnership = selectedOwnership,
selectedConstraintProviders = selectedConstraintProviders,
allProviders = allProviders,
isDaitaEnabled = settings?.daitaAndDirectOnly() == true,
daitaDirectOnly = settings?.daitaAndDirectOnly() == true,
isMultihopEnabled = wireguardConstraints?.isMultihopEnabled == true,
relayListType = relayListType,
)
Expand All @@ -49,7 +49,7 @@ class FilterChipUseCase(
selectedOwnership: Constraint<Ownership>,
selectedConstraintProviders: Constraint<Providers>,
allProviders: List<Provider>,
isDaitaEnabled: Boolean,
daitaDirectOnly: Boolean,
isMultihopEnabled: Boolean,
relayListType: RelayListType,
): List<FilterChip> {
Expand All @@ -73,7 +73,7 @@ class FilterChipUseCase(
}
if (
shouldFilterByDaita(
isDaitaEnabled = isDaitaEnabled,
daitaDirectOnly = daitaDirectOnly,
relayListType = relayListType,
isMultihopEnabled = isMultihopEnabled,
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class FilteredRelayListUseCase(
providers = selectedProviders,
shouldFilterByDaita =
shouldFilterByDaita(
isDaitaEnabled = settings?.daitaAndDirectOnly() == true,
daitaDirectOnly = settings?.daitaAndDirectOnly() == true,
isMultihopEnabled = wireguardConstraints?.isMultihopEnabled == true,
relayListType = relayListType,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class FilterCustomListsRelayItemUseCase(
providers = selectedProviders,
daita =
shouldFilterByDaita(
isDaitaEnabled = settings?.daitaAndDirectOnly() == true,
daitaDirectOnly = settings?.daitaAndDirectOnly() == true,
isMultihopEnabled = wireguardConstraints?.isMultihopEnabled == true,
relayListType = relayListType,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ package net.mullvad.mullvadvpn.util
import net.mullvad.mullvadvpn.compose.state.RelayListType

fun shouldFilterByDaita(
isDaitaEnabled: Boolean,
daitaDirectOnly: Boolean,
isMultihopEnabled: Boolean,
relayListType: RelayListType,
) =
isDaitaEnabled &&
daitaDirectOnly &&
(relayListType == RelayListType.ENTRY ||
!isMultihopEnabled && relayListType == RelayListType.EXIT)

0 comments on commit 477c4ea

Please sign in to comment.