Network Type Transition Optimization
Nucleic-Session: 40F8C53A-F001-423A-8607-EAE181DBE14B Co-authored-by: Nucleic <[email protected]>
This commit is contained in:
@@ -28,7 +28,12 @@ struct NucleicRemoteApp: App {
|
|||||||
// activity flag current so it only notifies for background transitions.
|
// activity flag current so it only notifies for background transitions.
|
||||||
.onChange(of: scenePhase) { _, phase in
|
.onChange(of: scenePhase) { _, phase in
|
||||||
store.setScenePhaseActive(phase == .active)
|
store.setScenePhaseActive(phase == .active)
|
||||||
if phase == .active { Task { await HeartbeatReporter.reportIfDue() } }
|
if phase == .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() }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user