minor refactor on answering call logic

This commit is contained in:
ryanzhao 2021-11-12 10:31:58 +11:00
parent 02d0499618
commit 925bc8538c
3 changed files with 6 additions and 6 deletions

View File

@ -23,13 +23,14 @@ extension SessionCallManager: CXProviderDelegate {
} else {
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully
let callVC = CallVC(for: self.currentCall!)
callVC.shouldAnswer = true
if let conversationVC = presentingVC as? ConversationVC {
callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0
}
presentingVC.present(callVC, animated: true, completion: nil)
presentingVC.present(callVC, animated: true) {
call.answerSessionCall()
}
}
action.fulfill()
} else {

View File

@ -6,7 +6,6 @@ import UIKit
final class CallVC : UIViewController, VideoPreviewDelegate {
let call: SessionCall
var shouldAnswer = false
var shouldRestartCamera = true
weak var conversationVC: ConversationVC? = nil
@ -218,7 +217,6 @@ final class CallVC : UIViewController, VideoPreviewDelegate {
}
}
}
if shouldAnswer { answerCall() }
}
func setUpViewHierarchy() {

View File

@ -153,13 +153,14 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
dismiss()
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully
let callVC = CallVC(for: self.call)
callVC.shouldAnswer = answer
if let conversationVC = presentingVC as? ConversationVC {
callVC.conversationVC = conversationVC
conversationVC.inputAccessoryView?.isHidden = true
conversationVC.inputAccessoryView?.alpha = 0
}
presentingVC.present(callVC, animated: true, completion: nil)
presentingVC.present(callVC, animated: true) {
if answer { self.call.answerSessionCall() }
}
}
public func show() {