ios: fix backgrounding error

This commit is contained in:
2025-11-15 16:15:53 -08:00
parent 58a43a617e
commit f3053c1db1

View File

@@ -121,9 +121,15 @@ extension ContentView
await clearConnectionErrorIfNecessary() await clearConnectionErrorIfNecessary()
await handle(event: event) await handle(event: event)
case .error(let error): case .error(let error):
// Ignore if we're in the bg
guard scenePhase == .active else { break }
// Check if this is a backgrounding error (connection abort) // Check if this is a backgrounding error (connection abort)
let nsError = error as NSError var isBackgroundingError = false
let isBackgroundingError = nsError.code == 53 if case let .websocketError(wsError) = error {
let nsError = wsError as NSError
isBackgroundingError = nsError.code == 53
}
// Only show connection error to user if it's not a backgrounding error // Only show connection error to user if it's not a backgrounding error
if !isBackgroundingError { if !isBackgroundingError {