From a220f590fd3f4bdf5b1764ca3d36c975fcc69bd9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20G=C3=B6ransson?= Date: Mon, 23 Dec 2024 18:32:12 +0100 Subject: [PATCH] Fix error --- .../net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt | 3 ++- .../mullvad/mullvadvpn/compose/state/RelayFilterUiState.kt | 6 +++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt index 00d1e3bb9acb..7cc375f18588 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreen.kt @@ -247,7 +247,8 @@ private fun LazyItemScope.RemovedProvider( state: RelayFilterUiState, onSelectedProvider: (checked: Boolean, providerId: ProviderId) -> Unit, ) { - val checked = providerId in state.selectedProviders + val checked = + state.selectedProviders is Constraint.Only && providerId in state.selectedProviders.value CheckboxCell( title = stringResource(R.string.removed_provider, providerId.value), checked = checked, diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterUiState.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterUiState.kt index d3e8a2b6856c..cd4b2b324f6d 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterUiState.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/state/RelayFilterUiState.kt @@ -35,7 +35,11 @@ data class RelayFilterUiState( }.sorted() val isApplyButtonEnabled = selectedProviders.getOrNull()?.isNotEmpty() != false - val removedProviders: List = selectedProviders - allProviders + val removedProviders: List = + when (selectedProviders) { + Constraint.Any -> emptyList() + is Constraint.Only -> selectedProviders.value.toList() - allProviders + } val isAllProvidersChecked = selectedProviders is Constraint.Any }