pull/562/head
Ryan Zhao 2 years ago
parent 7333d50825
commit 3fb7babecb

@ -21,7 +21,7 @@ extension SessionCallManager: CXProviderDelegate {
if let _ = CurrentAppContext().frontmostViewController() as? CallVC {
call.answerSessionCall()
} else {
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: self.currentCall!)
if let conversationVC = presentingVC as? ConversationVC {
callVC.conversationVC = conversationVC

@ -114,7 +114,7 @@ public final class SessionCallManager: NSObject {
} else {
call.updateCallMessage(mode: .local)
}
self.currentCall?.webRTCSession.dropConnection()
call.webRTCSession.dropConnection()
self.currentCall = nil
WebRTCSession.current = nil
}

@ -151,7 +151,7 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
public func showCallVC(answer: Bool) {
dismiss()
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: self.call)
if let conversationVC = presentingVC as? ConversationVC {
callVC.conversationVC = conversationVC

@ -96,7 +96,7 @@ final class MiniCallView: UIView, RTCVideoViewDelegate {
// MARK: Interaction
@objc private func handleTap(_ gestureRecognizer: UITapGestureRecognizer) {
dismiss()
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // FIXME: Handle more gracefully
presentingVC.present(callVC, animated: true, completion: nil)
}

@ -44,11 +44,6 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
present(callVC, animated: true, completion: nil)
}
}
internal func showCallVCIfNeeded() {
guard let incomingCallBanner = IncomingCallBanner.current else { return }
incomingCallBanner.showCallVC(answer: false)
}
// MARK: Blocking
@objc func unblock() {

@ -263,7 +263,6 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
didFinishInitialLayout = true
markAllAsRead()
self.becomeFirstResponder()
showCallVCIfNeeded()
}
override func viewWillDisappear(_ animated: Bool) {

@ -9,8 +9,9 @@ extension AppDelegate {
// MARK: Call handling
@objc func handleAppActivatedWithOngoingCallIfNeeded() {
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 }
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)
if let conversationVC = presentingVC as? ConversationVC, let contactThread = conversationVC.thread as? TSContactThread, contactThread.contactSessionID() == call.sessionID {
callVC.conversationVC = conversationVC
@ -33,7 +34,7 @@ extension AppDelegate {
SNLog("[Calls] Failed to report incoming call to CallKit due to error: \(error)")
} else {
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 {
let callVC = CallVC(for: call)
callVC.conversationVC = conversationVC

Loading…
Cancel
Save