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

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

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

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

@ -96,7 +96,7 @@ final class MiniCallView: UIView, RTCVideoViewDelegate {
// MARK: Interaction // MARK: Interaction
@objc private func handleTap(_ gestureRecognizer: UITapGestureRecognizer) { @objc private func handleTap(_ gestureRecognizer: UITapGestureRecognizer) {
dismiss() 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) presentingVC.present(callVC, animated: true, completion: nil)
} }

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

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

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

Loading…
Cancel
Save