ios: fix backgrounding error
This commit is contained in:
@@ -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 {
|
||||||
|
|||||||
Reference in New Issue
Block a user