mirror of
https://github.com/sudosylabs/vnidrop.git
synced 2026-08-05 10:29:58 +02:00
feat(apple): keep iOS transfers alive in the background
iOS suspends the process on backgrounding, freezing the core's network threads so in-flight transfers stall and never fire notifications. Hold a UIApplication background-task assertion (BackgroundActivityController) while transfers/shares are active so iOS grants its grace window — long enough to finish and notify. Released on foreground, on completion, or on expiration. No UIBackgroundModes added (keeps App Store validation clean); macOS is a no-op since it already runs unfocused. Add a localized iOS-only Settings notice explaining the platform limit so it doesn't read as a bug.
This commit is contained in:
@@ -81,12 +81,18 @@ struct RootView: View {
|
||||
switch phase {
|
||||
case .active:
|
||||
graph.visibility.setForeground(true)
|
||||
graph.backgroundActivity.didBecomeForeground()
|
||||
settingsModel.refreshNotificationPermission()
|
||||
// Reconcile against the durable snapshot: while the window was
|
||||
// unfocused/occluded (common on macOS) live events may not have
|
||||
// rendered, leaving progress/status stale.
|
||||
Task { _ = await graph.coreRepository.refresh() }
|
||||
case .background, .inactive:
|
||||
case .background:
|
||||
graph.visibility.setForeground(false)
|
||||
// Hold the process open for iOS's grace window so an active
|
||||
// transfer can finish and notify before suspension.
|
||||
graph.backgroundActivity.didEnterBackground()
|
||||
case .inactive:
|
||||
graph.visibility.setForeground(false)
|
||||
@unknown default:
|
||||
break
|
||||
|
||||
Reference in New Issue
Block a user