diff --git a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt index edb86e3414ca..b5f762b89b22 100644 --- a/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt +++ b/android/app/src/androidTest/kotlin/net/mullvad/mullvadvpn/compose/screen/FilterScreenTest.kt @@ -77,7 +77,7 @@ class FilterScreenTest { } composeTestRule.apply { onNodeWithText("Ownership").performClick() - onNodeWithText("Mullvad owned only").performClick() + onNodeWithText("Mullvad owned only").assertExists() } } diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt index 6566a9f30e5a..48bd82941b3b 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/compose/cell/FilterCell.kt @@ -52,7 +52,7 @@ fun FilterCell( .fillMaxWidth(), ) { Text( - modifier = Modifier.padding(end = Dimens.filterTittlePadding), + modifier = Modifier.padding(end = Dimens.filterTitlePadding), text = stringResource(id = R.string.filtered), color = MaterialTheme.colorScheme.onPrimary, style = MaterialTheme.typography.labelMedium diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt index f5e24dacf187..4fc6fdb6ff83 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/MainActivity.kt @@ -42,7 +42,6 @@ import net.mullvad.mullvadvpn.repository.PrivacyDisclaimerRepository import net.mullvad.mullvadvpn.ui.fragment.AccountFragment import net.mullvad.mullvadvpn.ui.fragment.ConnectFragment import net.mullvad.mullvadvpn.ui.fragment.DeviceRevokedFragment -import net.mullvad.mullvadvpn.ui.fragment.FilterFragment import net.mullvad.mullvadvpn.ui.fragment.LoadingFragment import net.mullvad.mullvadvpn.ui.fragment.LoginFragment import net.mullvad.mullvadvpn.ui.fragment.OutOfTimeFragment @@ -174,20 +173,6 @@ open class MainActivity : FragmentActivity() { } } - fun openFilter() { - supportFragmentManager.beginTransaction().apply { - setCustomAnimations( - R.anim.fragment_enter_from_right, - R.anim.do_nothing, - R.anim.do_nothing, - R.anim.fragment_exit_to_right - ) - replace(R.id.main_fragment, FilterFragment()) - addToBackStack(null) - commitAllowingStateLoss() - } - } - private fun launchDeviceStateHandler(): Job { return lifecycleScope.launch { launch { diff --git a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt index 64fdee71f625..555da6d950ef 100644 --- a/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt +++ b/android/app/src/main/kotlin/net/mullvad/mullvadvpn/ui/fragment/SelectLocationFragment.kt @@ -9,7 +9,6 @@ import androidx.compose.ui.platform.ComposeView import net.mullvad.mullvadvpn.R import net.mullvad.mullvadvpn.compose.screen.SelectLocationScreen import net.mullvad.mullvadvpn.lib.theme.AppTheme -import net.mullvad.mullvadvpn.ui.MainActivity import net.mullvad.mullvadvpn.viewmodel.SelectLocationViewModel import org.koin.androidx.viewmodel.ext.android.viewModel @@ -35,15 +34,25 @@ class SelectLocationFragment : BaseFragment() { onBackClick = { activity?.onBackPressedDispatcher?.onBackPressed() }, removeOwnershipFilter = vm::removeOwnerFilter, removeProviderFilter = vm::removeProviderFilter, - onFilterClick = ::openFilterView + onFilterClick = ::openFilter ) } } } } - private fun openFilterView() { - (context as? MainActivity)?.openFilter() + private fun openFilter() { + parentFragmentManager.beginTransaction().apply { + setCustomAnimations( + R.anim.fragment_enter_from_right, + R.anim.do_nothing, + R.anim.do_nothing, + R.anim.fragment_exit_to_right + ) + replace(R.id.main_fragment, FilterFragment()) + addToBackStack(null) + commitAllowingStateLoss() + } } override fun onEnterTransitionAnimationEnd() { diff --git a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt index 30b3f6e064d0..9f61ea4a91b2 100644 --- a/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt +++ b/android/app/src/test/kotlin/net/mullvad/mullvadvpn/viewmodel/FilterViewModelTest.kt @@ -31,7 +31,7 @@ class FilterViewModelTest { private lateinit var viewModel: FilterViewModel private val selectedOwnership = MutableStateFlow>(Constraint.Only(Ownership.MullvadOwned)) - private val mockAllProviders = + private val dummyListOfAllProviders = listOf( Provider("31173", true), Provider("100TB", false), @@ -57,7 +57,8 @@ class FilterViewModelTest { @Before fun setup() { every { mockRelayListFilterUseCase.selectedOwnership() } returns selectedOwnership - every { mockRelayListFilterUseCase.availableProviders() } returns flowOf(mockAllProviders) + every { mockRelayListFilterUseCase.availableProviders() } returns + flowOf(dummyListOfAllProviders) every { mockRelayListFilterUseCase.selectedProviders() } returns flowOf(Constraint.Only(Providers(mockSelectedProviders.map { it.name }.toHashSet()))) viewModel = FilterViewModel(mockRelayListFilterUseCase) @@ -99,7 +100,7 @@ class FilterViewModelTest { @Test fun testSetAllProviders() = runTest { // Arrange - val mockProvidersList = mockAllProviders + val mockProvidersList = dummyListOfAllProviders // Act viewModel.setAllProviders(true) // Assert @@ -113,7 +114,8 @@ class FilterViewModelTest { fun testOnApplyButtonClicked() = runTest { // Arrange val mockOwnership = Ownership.MullvadOwned.toOwnershipConstraint() - val mockSelectedProviders = mockSelectedProviders.toConstraintProviders(mockAllProviders) + val mockSelectedProviders = + mockSelectedProviders.toConstraintProviders(dummyListOfAllProviders) // Act viewModel.onApplyButtonClicked() // Assert diff --git a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/dimensions/Dimensions.kt b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/dimensions/Dimensions.kt index 702260741695..7b4333e38c84 100644 --- a/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/dimensions/Dimensions.kt +++ b/android/lib/theme/src/main/kotlin/net/mullvad/mullvadvpn/lib/theme/dimensions/Dimensions.kt @@ -35,7 +35,7 @@ data class Dimensions( val dialogIconHeight: Dp = 44.dp, val dialogIconSize: Dp = 48.dp, val expandableCellChevronSize: Dp = 30.dp, - val filterTittlePadding: Dp = 4.dp, + val filterTitlePadding: Dp = 4.dp, val iconFailSuccessTopMargin: Dp = 30.dp, val iconHeight: Dp = 44.dp, val indentedCellStartPadding: Dp = 38.dp,