diff --git a/Session/Calls/Call Management/SessionCallManager.swift b/Session/Calls/Call Management/SessionCallManager.swift index efd1eb13f..8568d7d85 100644 --- a/Session/Calls/Call Management/SessionCallManager.swift +++ b/Session/Calls/Call Management/SessionCallManager.swift @@ -190,9 +190,11 @@ public final class SessionCallManager: NSObject, CallManagerProtocol { if dependencies[singleton: .appContext].isInBackground { // Stop all jobs except for message sending and when completed suspend the database dependencies[singleton: .jobRunner].stopAndClearPendingJobs(exceptForVariant: .messageSend) { [dependencies] _ in - dependencies.mutate(cache: .libSessionNetwork) { $0.suspendNetworkAccess() } - dependencies[singleton: .storage].suspendDatabaseAccess() - Log.flush() + if self.currentCall?.hasEnded != false { + dependencies.mutate(cache: .libSessionNetwork) { $0.suspendNetworkAccess() } + dependencies[singleton: .storage].suspendDatabaseAccess() + Log.flush() + } } } } diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 3bcee7a69..6a774eb7b 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -361,7 +361,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD Log.info(.backgroundPoller, "Background poll failed due to manual timeout.") cancellable?.cancel() - if dependencies[singleton: .appContext].isInBackground { + if dependencies[singleton: .appContext].isInBackground && !self.hasCallOngoing() { dependencies.mutate(cache: .libSessionNetwork) { $0.suspendNetworkAccess() } dependencies[singleton: .storage].suspendDatabaseAccess() Log.flush() @@ -404,7 +404,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD } // If we are still running in the background then suspend the network & database - if dependencies[singleton: .appContext].isInBackground { + if dependencies[singleton: .appContext].isInBackground && !self.hasCallOngoing() { dependencies.mutate(cache: .libSessionNetwork) { $0.suspendNetworkAccess() } dependencies[singleton: .storage].suspendDatabaseAccess() Log.flush()