summaryrefslogtreecommitdiffhomepage
path: root/ios/MullvadVPN
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2024-03-01 15:21:59 +0100
committerBug Magnet <marco.nikic@mullvad.net>2024-03-04 09:37:07 +0100
commit4d12a45f172f030dff7188de8e0bd3a7bcbb06d0 (patch)
tree20918b278fe9460f549780cdb1e9756bc6b9195c /ios/MullvadVPN
parent624d37a1ebd67b83859271b043e14ac34eadddbb (diff)
downloadmullvadvpn-4d12a45f172f030dff7188de8e0bd3a7bcbb06d0.tar.xz
mullvadvpn-4d12a45f172f030dff7188de8e0bd3a7bcbb06d0.zip
Fix LocationDataSource crash in MockRelease build
Diffstat (limited to 'ios/MullvadVPN')
-rw-r--r--ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift21
1 files changed, 13 insertions, 8 deletions
diff --git a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
index 1a026e54e9..a8bd237226 100644
--- a/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
+++ b/ios/MullvadVPN/View controllers/SelectLocation/LocationDataSource.swift
@@ -26,7 +26,10 @@ final class LocationDataSource: UITableViewDiffableDataSource<SelectLocationSect
customLists: LocationDataSourceProtocol
) {
self.tableView = tableView
+
+ #if DEBUG
self.dataSources.append(customLists)
+ #endif
self.dataSources.append(allLocations)
let locationCellFactory = LocationCellFactory(
@@ -76,14 +79,16 @@ final class LocationDataSource: UITableViewDiffableDataSource<SelectLocationSect
.map { LocationCellViewModel(group: group, location: $0) }
}
- updateDataSnapshot(with: list, reloadExisting: !searchString.isEmpty)
-
- if searchString.isEmpty {
- setSelectedRelayLocation(selectedRelayLocation, animated: false, completion: {
- self.scrollToSelectedRelay()
- })
- } else {
- scrollToTop(animated: false)
+ updateDataSnapshot(with: list, reloadExisting: !searchString.isEmpty) {
+ DispatchQueue.main.async {
+ if searchString.isEmpty {
+ self.setSelectedRelayLocation(self.selectedRelayLocation, animated: false, completion: {
+ self.scrollToSelectedRelay()
+ })
+ } else {
+ self.scrollToTop(animated: false)
+ }
+ }
}
}