fix call connection

pull/560/head
ryanzhao 4 years ago
parent bef20e2f9a
commit 888df37581

@ -125,6 +125,7 @@ public final class SessionCall: NSObject, WebRTCSessionDelegate {
self.uuid = UUID(uuidString: uuid)! self.uuid = UUID(uuidString: uuid)!
self.mode = mode self.mode = mode
self.webRTCSession = WebRTCSession.current ?? WebRTCSession(for: sessionID, with: uuid) self.webRTCSession = WebRTCSession.current ?? WebRTCSession(for: sessionID, with: uuid)
WebRTCSession.current = self.webRTCSession
super.init() super.init()
self.webRTCSession.delegate = self self.webRTCSession.delegate = self
} }

@ -62,7 +62,7 @@ public final class SessionCallManager: NSObject {
let update = CXCallUpdate() let update = CXCallUpdate()
update.localizedCallerName = callerName update.localizedCallerName = callerName
update.remoteHandle = CXHandle(type: .generic, value: call.uuid.uuidString) update.remoteHandle = CXHandle(type: .generic, value: call.uuid.uuidString)
update.hasVideo = true update.hasVideo = false
disableUnsupportedFeatures(callUpdate: update) disableUnsupportedFeatures(callUpdate: update)

@ -7,17 +7,16 @@ extension AppDelegate {
// MARK: Call handling // MARK: Call handling
func createNewIncomingCall(caller: String, uuid: String) { func createNewIncomingCall(caller: String, uuid: String) {
DispatchQueue.main.async {
let call = SessionCall(for: caller, uuid: uuid, mode: .answer) let call = SessionCall(for: caller, uuid: uuid, mode: .answer)
if CurrentAppContext().isMainAppAndActive { if CurrentAppContext().isMainAppAndActive {
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully 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 { if let conversationVC = presentingVC as? ConversationVC, let contactThread = conversationVC.thread as? TSContactThread, contactThread.contactSessionID() == caller {
DispatchQueue.main.async {
let callVC = CallVC(for: call) let callVC = CallVC(for: call)
callVC.conversationVC = conversationVC callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0 conversationVC.inputAccessoryView?.alpha = 0
presentingVC.present(callVC, animated: true, completion: nil) presentingVC.present(callVC, animated: true, completion: nil)
}
return return
} }
} }
@ -29,6 +28,7 @@ extension AppDelegate {
} }
} }
} }
}
@objc func setUpCallHandling() { @objc func setUpCallHandling() {
// Pre offer messages // Pre offer messages

Loading…
Cancel
Save