Skip to content

armgit / TREK

Public Imported from GitHub
0

The most complete open-source travel planner: real-time collaboration, bookings, budgets, packing lists, journals, offline PWA, SSO and an AI-ready MCP server, with planet-wide place search and routing built in.

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

Mauricebd215b7ec795
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)