diff options
| author | Bug Magnet <marco.nikic@mullvad.net> | 2025-05-22 14:36:35 +0200 |
|---|---|---|
| committer | Bug Magnet <marco.nikic@mullvad.net> | 2025-05-22 14:36:35 +0200 |
| commit | 350667e42d085281429cd92bba1c2612545c2368 (patch) | |
| tree | 78bcf2102f0fa4af238fdc6c67f49692ace1362a | |
| parent | c3f60de4179ea77718931faa07bf18479901f965 (diff) | |
| parent | 64f71c2a017dbb7719cfb4794dc8f610b1ca4e81 (diff) | |
| download | mullvadvpn-350667e42d085281429cd92bba1c2612545c2368.tar.xz mullvadvpn-350667e42d085281429cd92bba1c2612545c2368.zip | |
Merge branch 'ios-1156-default-expand-filters'
| -rw-r--r-- | ios/MullvadVPN/View controllers/RelayFilter/RelayFilterDataSource.swift | 17 | ||||
| -rw-r--r-- | ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift | 4 |
2 files changed, 14 insertions, 7 deletions
diff --git a/ios/MullvadVPN/View controllers/RelayFilter/RelayFilterDataSource.swift b/ios/MullvadVPN/View controllers/RelayFilter/RelayFilterDataSource.swift index a6aa13478c..12b7805ee2 100644 --- a/ios/MullvadVPN/View controllers/RelayFilter/RelayFilterDataSource.swift +++ b/ios/MullvadVPN/View controllers/RelayFilter/RelayFilterDataSource.swift @@ -34,6 +34,7 @@ final class RelayFilterDataSource: UITableViewDiffableDataSource< createDataSnapshot() tableView.delegate = self setupBindings() + updateSelection(from: viewModel.relayFilter) } private func registerCells() { @@ -59,9 +60,19 @@ final class RelayFilterDataSource: UITableViewDiffableDataSource< .store(in: &disposeBag) } + private func availableProviders(givenOwnership ownership: RelayFilter.Ownership) -> [RelayFilterDataSourceItem] { + [RelayFilterDataSourceItem.allProviders] + viewModel + .availableProviders(for: ownership) + } + private func createDataSnapshot() { var snapshot = NSDiffableDataSourceSnapshot<Section, RelayFilterDataSourceItem>() snapshot.appendSections(Section.allCases) + snapshot.appendItems(RelayFilterDataSourceItem.ownerships, toSection: .ownership) + snapshot.appendItems( + availableProviders(givenOwnership: viewModel.relayFilter.ownership), + toSection: .providers + ) apply(snapshot, animatingDifferences: false) } @@ -79,7 +90,7 @@ final class RelayFilterDataSource: UITableViewDiffableDataSource< case .providers: if !oldSnapshot.itemIdentifiers(inSection: section).isEmpty { newSnapshot.appendItems( - [RelayFilterDataSourceItem.allProviders] + viewModel.availableProviders(for: filter.ownership), + availableProviders(givenOwnership: filter.ownership), toSection: .providers ) applySnapshot(newSnapshot, animated: false) @@ -161,8 +172,7 @@ final class RelayFilterDataSource: UITableViewDiffableDataSource< newSnapshot.deleteItems(items) } else { newSnapshot.appendItems( - [RelayFilterDataSourceItem.allProviders] + viewModel - .availableProviders(for: viewModel.relayFilter.ownership), + availableProviders(givenOwnership: viewModel.relayFilter.ownership), toSection: .providers ) } @@ -256,6 +266,7 @@ extension RelayFilterDataSource: UITableViewDelegate { title = "Providers" } + view.isExpanded = true view.setAccessibilityIdentifier(accessibilityIdentifier) view.titleLabel.text = NSLocalizedString( "RELAY_FILTER_HEADER_LABEL", diff --git a/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift b/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift index cc617b15b2..e736da1d75 100644 --- a/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift +++ b/ios/MullvadVPNUITests/Screenshots/ScreenshotTests.swift @@ -104,10 +104,6 @@ class ScreenshotTests: LoggedInWithTimeUITestCase { SelectLocationPage(app) .tapFilterButton() - SelectLocationFilterPage(app) - .tapOwnershipCellExpandButton() - .tapProvidersCellExpandButton() - snapshot("RelayFilter") } |
