diff --git a/Session/Calls/Call Management/SessionCall.swift b/Session/Calls/Call Management/SessionCall.swift index a1c2fc9a8..a2d0104ab 100644 --- a/Session/Calls/Call Management/SessionCall.swift +++ b/Session/Calls/Call Management/SessionCall.swift @@ -125,6 +125,7 @@ public final class SessionCall: NSObject, WebRTCSessionDelegate { self.uuid = UUID(uuidString: uuid)! self.mode = mode self.webRTCSession = WebRTCSession.current ?? WebRTCSession(for: sessionID, with: uuid) + WebRTCSession.current = self.webRTCSession super.init() self.webRTCSession.delegate = self } diff --git a/Session/Calls/Call Management/SessionCallManager.swift b/Session/Calls/Call Management/SessionCallManager.swift index 914bf5255..72978f143 100644 --- a/Session/Calls/Call Management/SessionCallManager.swift +++ b/Session/Calls/Call Management/SessionCallManager.swift @@ -62,7 +62,7 @@ public final class SessionCallManager: NSObject { let update = CXCallUpdate() update.localizedCallerName = callerName update.remoteHandle = CXHandle(type: .generic, value: call.uuid.uuidString) - update.hasVideo = true + update.hasVideo = false disableUnsupportedFeatures(callUpdate: update) diff --git a/Session/Meta/AppDelegate.swift b/Session/Meta/AppDelegate.swift index be98926c7..d6c994d10 100644 --- a/Session/Meta/AppDelegate.swift +++ b/Session/Meta/AppDelegate.swift @@ -7,25 +7,25 @@ extension AppDelegate { // MARK: Call handling func createNewIncomingCall(caller: String, uuid: String) { - let call = SessionCall(for: caller, uuid: uuid, mode: .answer) - if CurrentAppContext().isMainAppAndActive { - guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully - if let conversationVC = presentingVC as? ConversationVC, let contactThread = conversationVC.thread as? TSContactThread, contactThread.contactSessionID() == caller { - DispatchQueue.main.async { + DispatchQueue.main.async { + let call = SessionCall(for: caller, uuid: uuid, mode: .answer) + if CurrentAppContext().isMainAppAndActive { + guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully + if let conversationVC = presentingVC as? ConversationVC, let contactThread = conversationVC.thread as? TSContactThread, contactThread.contactSessionID() == caller { let callVC = CallVC(for: call) callVC.conversationVC = conversationVC conversationVC.inputAccessoryView?.isHidden = true conversationVC.inputAccessoryView?.alpha = 0 presentingVC.present(callVC, animated: true, completion: nil) + return } - return } - } - call.reportIncomingCallIfNeeded{ error in - if let error = error { - SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)") - let incomingCallBanner = IncomingCallBanner(for: call) - incomingCallBanner.show() + call.reportIncomingCallIfNeeded{ error in + if let error = error { + SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)") + let incomingCallBanner = IncomingCallBanner(for: call) + incomingCallBanner.show() + } } } }