From bd215b7ec795275499d90d82dc9ee138695c11f7 Mon Sep 17 00:00:00 2001 From: Maurice Date: Mon, 23 Nov 2026 14:53:18 +0100 Subject: [PATCH] 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. --- client/ios/App/App/TrekBridgeViewController.swift | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/client/ios/App/App/TrekBridgeViewController.swift b/client/ios/App/App/TrekBridgeViewController.swift index 30f0b3fd2..3fb43d6c1 100644 --- a/client/ios/App/App/TrekBridgeViewController.swift +++ b/client/ios/App/App/TrekBridgeViewController.swift @@ -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)