|
|
@ -28,6 +28,10 @@ extension AppDelegate {
|
|
|
|
|
|
|
|
|
|
|
|
private func showCallUIForCall(_ call: SessionCall) {
|
|
|
|
private func showCallUIForCall(_ call: SessionCall) {
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
DispatchQueue.main.async {
|
|
|
|
|
|
|
|
call.reportIncomingCallIfNeeded{ error in
|
|
|
|
|
|
|
|
if let error = error {
|
|
|
|
|
|
|
|
SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)")
|
|
|
|
|
|
|
|
} else {
|
|
|
|
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() == call.sessionID {
|
|
|
|
if let conversationVC = presentingVC as? ConversationVC, let contactThread = conversationVC.thread as? TSContactThread, contactThread.contactSessionID() == call.sessionID {
|
|
|
@ -38,11 +42,6 @@ extension AppDelegate {
|
|
|
|
presentingVC.present(callVC, animated: true, completion: nil)
|
|
|
|
presentingVC.present(callVC, animated: true, completion: nil)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
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()
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|