|
|
@ -9,8 +9,9 @@ extension AppDelegate {
|
|
|
|
// MARK: Call handling
|
|
|
|
// MARK: Call handling
|
|
|
|
@objc func handleAppActivatedWithOngoingCallIfNeeded() {
|
|
|
|
@objc func handleAppActivatedWithOngoingCallIfNeeded() {
|
|
|
|
guard let call = AppEnvironment.shared.callManager.currentCall else { return }
|
|
|
|
guard let call = AppEnvironment.shared.callManager.currentCall else { return }
|
|
|
|
|
|
|
|
guard MiniCallView.current == nil else { return }
|
|
|
|
if let callVC = CurrentAppContext().frontmostViewController() as? CallVC, callVC.call == call { return }
|
|
|
|
if let callVC = CurrentAppContext().frontmostViewController() as? CallVC, callVC.call == call { return }
|
|
|
|
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully
|
|
|
|
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // FIXME: Handle more gracefully
|
|
|
|
let callVC = CallVC(for: call)
|
|
|
|
let callVC = CallVC(for: call)
|
|
|
|
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 {
|
|
|
|
callVC.conversationVC = conversationVC
|
|
|
|
callVC.conversationVC = conversationVC
|
|
|
@ -33,7 +34,7 @@ extension AppDelegate {
|
|
|
|
SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)")
|
|
|
|
SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)")
|
|
|
|
} else {
|
|
|
|
} 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() } // FIXME: 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 {
|
|
|
|
let callVC = CallVC(for: call)
|
|
|
|
let callVC = CallVC(for: call)
|
|
|
|
callVC.conversationVC = conversationVC
|
|
|
|
callVC.conversationVC = conversationVC
|
|
|
|