summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorBug Magnet <marco.nikic@mullvad.net>2024-04-09 16:44:25 +0200
committerBug Magnet <marco.nikic@mullvad.net>2024-04-09 16:44:25 +0200
commit12869ab51ccdd65b6817a6cc31dd2e7765e0cba9 (patch)
treee51ad2b28488ff4a1c1c4577999f9dbc0eb4a88a
parentf8b62eb03c56ab993718e65e9b9aa91cc2721fd1 (diff)
parente0bdd96b88c9a4cacec4589e1bf1a41a737a1a44 (diff)
downloadmullvadvpn-12869ab51ccdd65b6817a6cc31dd2e7765e0cba9.tar.xz
mullvadvpn-12869ab51ccdd65b6817a6cc31dd2e7765e0cba9.zip
Merge branch 'offline-server-appears-online-ios-593'
-rw-r--r--ios/MullvadVPN/View controllers/SelectLocation/AllLocationDataSource.swift12
-rw-r--r--ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift4
2 files changed, 14 insertions, 2 deletions
diff --git a/ios/MullvadVPN/View controllers/SelectLocation/AllLocationDataSource.swift b/ios/MullvadVPN/View controllers/SelectLocation/AllLocationDataSource.swift
index f2f955968f..f57e980dea 100644
--- a/ios/MullvadVPN/View controllers/SelectLocation/AllLocationDataSource.swift
+++ b/ios/MullvadVPN/View controllers/SelectLocation/AllLocationDataSource.swift
@@ -64,7 +64,7 @@ class AllLocationDataSource: LocationDataSourceProtocol {
name: serverLocation.country,
code: LocationNode.combineNodeCodes([countryCode]),
locations: [location],
- isActive: relay.active
+ isActive: true // Defaults to true, updated when children are populated.
)
if !rootNode.children.contains(countryNode) {
@@ -77,7 +77,7 @@ class AllLocationDataSource: LocationDataSourceProtocol {
name: serverLocation.city,
code: LocationNode.combineNodeCodes([countryCode, cityCode]),
locations: [location],
- isActive: relay.active
+ isActive: true // Defaults to true, updated when children are populated.
)
if let countryNode = rootNode.countryFor(code: countryCode),
@@ -101,6 +101,14 @@ class AllLocationDataSource: LocationDataSourceProtocol {
hostNode.parent = cityNode
cityNode.children.append(hostNode)
cityNode.children.sort()
+
+ cityNode.isActive = cityNode.children.contains(where: { hostNode in
+ hostNode.isActive
+ })
+
+ countryNode.isActive = countryNode.children.contains(where: { cityNode in
+ cityNode.isActive
+ })
}
}
}
diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
index befcaacaf2..995b612e22 100644
--- a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
+++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
@@ -236,6 +236,10 @@ extension LocationDataSource: UITableViewDelegate {
}
}
+ func tableView(_ tableView: UITableView, shouldHighlightRowAt indexPath: IndexPath) -> Bool {
+ itemIdentifier(for: indexPath)?.node.isActive ?? false
+ }
+
func tableView(_ tableView: UITableView, indentationLevelForRowAt indexPath: IndexPath) -> Int {
itemIdentifier(for: indexPath)?.indentationLevel ?? 0
}