Network Reconnection Delay

Nucleic-Session: 4BE3E40C-E939-444C-8AED-93C0AFE13C07
Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
2026-07-06 12:46:02 -07:00
co-authored by Nucleic
parent 468af9dd4a
commit 9a0a46bc8b
@@ -31,11 +31,18 @@ struct NucleicRemoteApp: App {
// activity flag current so it only notifies for background transitions.
.onChange(of: scenePhase) { _, phase in
store.setScenePhaseActive(phase == .active)
if phase == .active {
switch phase {
case .active:
// Re-plan transports immediately on foreground — the network may have
// changed while suspended, so don't wait for a dead socket to notice.
store.onForeground()
Task { await HeartbeatReporter.reportIfDue() }
case .background:
// Hold the process (and its live sockets) briefly so a quick app-switch
// doesn't drop the connection and force a cold reconnect on return.
store.onBackground()
default:
break
}
}
}