fix call connection

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

@ -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
}

@ -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)

@ -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()
}
}
}
}

Loading…
Cancel
Save