@ -211,8 +211,10 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
// S t o p a l l j o b s e x c e p t f o r m e s s a g e s e n d i n g a n d w h e n c o m p l e t e d s u s p e n d t h e d a t a b a s e
// S t o p a l l j o b s e x c e p t f o r m e s s a g e s e n d i n g a n d w h e n c o m p l e t e d s u s p e n d t h e d a t a b a s e
JobRunner . stopAndClearPendingJobs ( exceptForVariant : . messageSend , using : dependencies ) {
JobRunner . stopAndClearPendingJobs ( exceptForVariant : . messageSend , using : dependencies ) {
if ! self . hasCallOngoing ( ) {
if ! self . hasCallOngoing ( ) {
Storage . suspendDatabaseAccess ( )
LibSession . closeNetworkConnections ( )
LibSession . closeNetworkConnections ( )
Storage . suspendDatabaseAccess ( )
Log . info ( " [AppDelegate] completed network and database shutdowns. " )
Log . flush ( )
}
}
}
}
}
}
@ -292,14 +294,15 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
guard BackgroundPoller . isValid else { return }
guard BackgroundPoller . isValid else { return }
Log . info ( " Background poll failed due to manual timeout " )
BackgroundPoller . isValid = false
BackgroundPoller . isValid = false
if Singleton . hasAppContext && Singleton . appContext . isInBackground {
if Singleton . hasAppContext && Singleton . appContext . isInBackground {
Storage . suspendDatabaseAccess ( )
LibSession . closeNetworkConnections ( )
LibSession . closeNetworkConnections ( )
Storage . suspendDatabaseAccess ( )
Log . flush ( )
}
}
Log . info ( " Background poll failed due to manual timeout " )
completionHandler ( . failed )
completionHandler ( . failed )
}
}
@ -322,8 +325,9 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD
BackgroundPoller . isValid = false
BackgroundPoller . isValid = false
if Singleton . hasAppContext && Singleton . appContext . isInBackground {
if Singleton . hasAppContext && Singleton . appContext . isInBackground {
Storage . suspendDatabaseAccess ( )
LibSession . closeNetworkConnections ( )
LibSession . closeNetworkConnections ( )
Storage . suspendDatabaseAccess ( )
Log . flush ( )
}
}
cancelTimer . invalidate ( )
cancelTimer . invalidate ( )