Skip to content

Commit 8addddb

Browse files
author
Jon Petersson
committed
Fix not showing the correct api access method in use on app reinstall
1 parent b469ef6 commit 8addddb

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

ios/MullvadREST/Transport/AccessMethodIterator.swift

+4-6
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,12 @@ class AccessMethodIterator {
3737
}
3838

3939
private func refreshCacheIfNeeded() {
40-
/// Validating the index of `lastReachableApiAccessCache` after any changes in `AccessMethodRepository`
41-
if let firstIndex = enabledConfigurations.firstIndex(where: { $0.id == self.lastReachableApiAccessId }) {
40+
// Validating the index of `lastReachableApiAccessCache` after any changes in `AccessMethodRepository`
41+
if let firstIndex = enabledConfigurations.firstIndex(where: { $0.id == lastReachableApiAccessId }) {
4242
index = firstIndex
43-
} else {
44-
/// When `firstIndex` is `nil`, that means the current configuration is not valid anymore
45-
/// Invalidating cache by replacing the `current` to the next enabled access method
46-
dataSource.saveLastReachable(pick())
4743
}
44+
45+
dataSource.saveLastReachable(pick())
4846
}
4947

5048
func rotate() {

0 commit comments

Comments
 (0)