summaryrefslogtreecommitdiffhomepage
path: root/ios
diff options
context:
space:
mode:
authorJon Petersson <jon.petersson@kvadrat.se>2024-03-21 15:09:28 +0100
committerBug Magnet <marco.nikic@mullvad.net>2024-03-22 08:23:14 +0100
commitbfb83c264e7fac8af9f648fa4bf27f8cbb092e08 (patch)
tree7e4dc4324ea1a8fccbbc5b78797b8b46356afa80 /ios
parentaa54d785cfeeb4e1c24538887c33c9892a5f1a91 (diff)
downloadmullvadvpn-bfb83c264e7fac8af9f648fa4bf27f8cbb092e08.tar.xz
mullvadvpn-bfb83c264e7fac8af9f648fa4bf27f8cbb092e08.zip
Fix not showing the correct api access method in use on app reinstall
Diffstat (limited to 'ios')
-rw-r--r--ios/MullvadREST/Transport/AccessMethodIterator.swift10
1 files changed, 4 insertions, 6 deletions
diff --git a/ios/MullvadREST/Transport/AccessMethodIterator.swift b/ios/MullvadREST/Transport/AccessMethodIterator.swift
index 531372efce..245bca30f5 100644
--- a/ios/MullvadREST/Transport/AccessMethodIterator.swift
+++ b/ios/MullvadREST/Transport/AccessMethodIterator.swift
@@ -37,14 +37,12 @@ class AccessMethodIterator {
}
private func refreshCacheIfNeeded() {
- /// Validating the index of `lastReachableApiAccessCache` after any changes in `AccessMethodRepository`
- if let firstIndex = enabledConfigurations.firstIndex(where: { $0.id == self.lastReachableApiAccessId }) {
+ // Validating the index of `lastReachableApiAccessCache` after any changes in `AccessMethodRepository`
+ if let firstIndex = enabledConfigurations.firstIndex(where: { $0.id == lastReachableApiAccessId }) {
index = firstIndex
- } else {
- /// When `firstIndex` is `nil`, that means the current configuration is not valid anymore
- /// Invalidating cache by replacing the `current` to the next enabled access method
- dataSource.saveLastReachable(pick())
}
+
+ dataSource.saveLastReachable(pick())
}
func rotate() {