summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@mullvad.net>2024-11-29 10:10:59 +0100
committerJon Petersson <jon.petersson@mullvad.net>2024-12-03 08:21:10 +0100
commit6afd27f10d23ca2ab0e2b6679adb1578a86ca11e (patch)
tree2eca24b42edc1e57d9acd8b3ab7f50f0517f4591
parent8bda210d18bf7fed9f024547d168dc1293d1dbd9 (diff)
downloadmullvadvpn-6afd27f10d23ca2ab0e2b6679adb1578a86ca11e.tar.xz
mullvadvpn-6afd27f10d23ca2ab0e2b6679adb1578a86ca11e.zip
Fix multiple Wireguard port selection in settings view
-rw-r--r--ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsDataSource.swift12
1 files changed, 9 insertions, 3 deletions
diff --git a/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsDataSource.swift b/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsDataSource.swift
index 0855d204b4..6f5f59a240 100644
--- a/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsDataSource.swift
+++ b/ios/MullvadVPN/View controllers/VPNSettings/VPNSettingsDataSource.swift
@@ -186,9 +186,12 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
weak var delegate: VPNSettingsDataSourceDelegate?
var selectedIndexPaths: [IndexPath] {
- let wireGuardPortItem: Item = viewModel.customWireGuardPort == nil
- ? .wireGuardPort(viewModel.wireGuardPort)
- : .wireGuardCustomPort
+ var wireGuardPortItem: Item = .wireGuardPort(viewModel.wireGuardPort)
+ if let customPort = indexPath(for: .wireGuardCustomPort) {
+ if tableView?.indexPathsForSelectedRows?.contains(customPort) ?? false {
+ wireGuardPortItem = .wireGuardCustomPort
+ }
+ }
let obfuscationStateItem: Item = switch viewModel.obfuscationState {
case .automatic: .wireGuardObfuscationAutomatic
@@ -253,6 +256,9 @@ final class VPNSettingsDataSource: UITableViewDiffableDataSource<
Item.wireGuardPorts.forEach { item in
if case let .wireGuardPort(port) = item, port == viewModel.wireGuardPort {
+ if let indexPath = indexPath(for: item) {
+ deselectAllRowsInSectionExceptRowAt(indexPath)
+ }
selectRow(at: item)
return
}