From 48c0c06c4bdc0b3b3d2da687b4bb47715c53220e Mon Sep 17 00:00:00 2001 From: ryanzhao Date: Fri, 14 Oct 2022 14:59:19 +1100 Subject: [PATCH] cherry pick bacd call fix & clean --- Session/Calls/Call Management/SessionCallManager.swift | 4 ++++ Session/Meta/AppDelegate.swift | 1 + Session/Notifications/PushRegistrationManager.swift | 2 +- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/Session/Calls/Call Management/SessionCallManager.swift b/Session/Calls/Call Management/SessionCallManager.swift index 38ecd7b75..b33177ff7 100644 --- a/Session/Calls/Call Management/SessionCallManager.swift +++ b/Session/Calls/Call Management/SessionCallManager.swift @@ -136,6 +136,10 @@ public final class SessionCallManager: NSObject, CallManagerProtocol { func handleCallEnded() { WebRTCSession.current = nil UserDefaults.sharedLokiProject?.set(false, forKey: "isCallOngoing") + if CurrentAppContext().isInBackground() { + (UIApplication.shared.delegate as? AppDelegate)?.stopPollers() + DDLog.flushLog() + } } guard let call = currentCall else { diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index 01618a22e..d5f2b2b66 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -33,6 +33,7 @@ class AppDelegate: UIResponder, UIApplicationDelegate, UNUserNotificationCenterD Cryptography.seedRandom() AppVersion.sharedInstance() + AppEnvironment.shared.pushRegistrationManager.createVoipRegistryIfNecessary() // Prevent the device from sleeping during database view async registration // (e.g. long database upgrades). diff --git a/Session/Notifications/PushRegistrationManager.swift b/Session/Notifications/PushRegistrationManager.swift index c2df1a4f9..171ae9617 100644 --- a/Session/Notifications/PushRegistrationManager.swift +++ b/Session/Notifications/PushRegistrationManager.swift @@ -173,7 +173,7 @@ public enum PushRegistrationError: Error { } } - private func createVoipRegistryIfNecessary() { + public func createVoipRegistryIfNecessary() { AssertIsOnMainThread() guard voipRegistry == nil else { return }