fix(ios): open the offline copy when an update rechecks an unreachable server

The recheck after an update ran on every bridge, also on the one the
offline start restarts, and moved the server it had just put back out
again, so the app looped between the address screen and a restart.
This commit is contained in:
Maurice
2026-11-23 14:53:18 +01:00
parent 98a05fa1fd
commit bd215b7ec7
@@ -501,9 +501,14 @@ enum TrekServerStore {
/// filled in with that server (previousURL). Raise both together.
private static let serverCheck = 3
private static var rechecked = false
/// Runs before the first bridge is built, so a server picked under an older
/// minimum is not loaded unchecked.
/// minimum is not loaded unchecked. Once per launch: the bridge that
/// restoreForOffline restarts must keep the server it put back.
static func recheckAfterUpdate() {
guard !rechecked else { return }
rechecked = true
let defaults = UserDefaults.standard
guard defaults.integer(forKey: checkedKey) < serverCheck else { return }
defaults.set(serverCheck, forKey: checkedKey)