feat(offline): mid-session flight-mode reactivity [PR2] #203
Reference in New Issue
Block a user
Delete Branch "feature/offline-flightmode"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Offline mode — PR2 of the auto-detect (mid-session reactivity). Follows #202 (cold-start). Fixes your observation: the online/offline detect worked only at cold start; toggling flight mode in the app had no effect.
Behaviour
React to the network changing while the app is open, via passive
online/offlineevents (no polling, ~no battery cost):Pieces
offline.svelte: trackauto— auto-detected vs deliberate (the distinction we designed).connection.svelte:checkReachableis a pure one-shot now (the caller decides); the reachability watcher never probes in offline mode (events drive recovery — no background network offline).transport.ts: the reachability probe is exempt from the kill switch — it IS the mechanism that decides whether to return online, fired only deliberately (the watcher is guarded off in offline;checkReachableruns it on anonlineevent).app.svelte.ts:initNetworkReactivitywires the events (web-only, skipped in the mock); called frombootstrap.Tests
Online unaffected — the listeners skip the mock: e2e 196. check 0, unit 479, gate 113.3/114 (no bump). Mid-session reactivity is contour-verified (the mock e2e can't simulate a device network toggle) — please test: play online → flight mode on (→ offline UI) → off (→ back online); and in deliberate offline, toggle flight mode (should stay offline).
Note: Capacitor
Network.addListener(native store app) is not wired here — the PWA target uses thewindowevents, which cover the mobile home-screen PWA. Native can be a follow-up.