show modal of ip exposure for calls
This commit is contained in:
parent
7dfb999239
commit
bcf0ecfb69
|
@ -320,14 +320,29 @@ final class CallVC : UIViewController, WebRTCSessionDelegate, VideoPreviewDelega
|
|||
}
|
||||
}
|
||||
|
||||
internal func showCallModal() {
|
||||
let callModal = CallModal() { [weak self] in
|
||||
self?.answerCall()
|
||||
}
|
||||
callModal.modalPresentationStyle = .overFullScreen
|
||||
callModal.modalTransitionStyle = .crossDissolve
|
||||
present(callModal, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc private func answerCall() {
|
||||
if case let .answer(sdp) = mode {
|
||||
callInfoLabel.text = "Connecting..."
|
||||
webRTCSession.handleRemoteSDP(sdp, from: sessionID) // This sends an answer message internally
|
||||
self.answerButton.alpha = 0
|
||||
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseIn, animations: {
|
||||
self.answerButton.isHidden = true
|
||||
}, completion: nil)
|
||||
let userDefaults = UserDefaults.standard
|
||||
if userDefaults[.hasSeenCallIPExposureWarning] {
|
||||
if case let .answer(sdp) = mode {
|
||||
callInfoLabel.text = "Connecting..."
|
||||
webRTCSession.handleRemoteSDP(sdp, from: sessionID) // This sends an answer message internally
|
||||
self.answerButton.alpha = 0
|
||||
UIView.animate(withDuration: 0.5, delay: 0, usingSpringWithDamping: 1, initialSpringVelocity: 1, options: .curveEaseIn, animations: {
|
||||
self.answerButton.isHidden = true
|
||||
}, completion: nil)
|
||||
}
|
||||
} else {
|
||||
userDefaults[.hasSeenCallIPExposureWarning] = true
|
||||
showCallModal()
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -140,7 +140,22 @@ final class IncomingCallBanner: UIView, UIGestureRecognizerDelegate {
|
|||
}
|
||||
|
||||
@objc private func answerCall() {
|
||||
showCallVC(answer: true)
|
||||
let userDefaults = UserDefaults.standard
|
||||
if userDefaults[.hasSeenCallIPExposureWarning] {
|
||||
showCallVC(answer: true)
|
||||
} else {
|
||||
showCallModal()
|
||||
}
|
||||
}
|
||||
|
||||
internal func showCallModal() {
|
||||
let callModal = CallModal() { [weak self] in
|
||||
self?.showCallVC(answer: true)
|
||||
}
|
||||
callModal.modalPresentationStyle = .overFullScreen
|
||||
callModal.modalTransitionStyle = .crossDissolve
|
||||
guard let presentingVC = CurrentAppContext().frontmostViewController() else { preconditionFailure() } // TODO: Handle more gracefully
|
||||
presentingVC.present(callModal, animated: true, completion: nil)
|
||||
}
|
||||
|
||||
@objc private func endCall() {
|
||||
|
|
|
@ -28,14 +28,20 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
|
|||
|
||||
// MARK: Call
|
||||
@objc func startCall(_ sender: Any?) {
|
||||
guard let contactSessionID = (thread as? TSContactThread)?.contactSessionID() else { return }
|
||||
let callVC = CallVC(for: contactSessionID, uuid: UUID().uuidString, mode: .offer)
|
||||
callVC.conversationVC = self
|
||||
callVC.modalPresentationStyle = .overFullScreen
|
||||
callVC.modalTransitionStyle = .crossDissolve
|
||||
self.inputAccessoryView?.isHidden = true
|
||||
self.inputAccessoryView?.alpha = 0
|
||||
present(callVC, animated: true, completion: nil)
|
||||
let userDefaults = UserDefaults.standard
|
||||
if userDefaults[.hasSeenCallIPExposureWarning] {
|
||||
guard let contactSessionID = (thread as? TSContactThread)?.contactSessionID() else { return }
|
||||
let callVC = CallVC(for: contactSessionID, uuid: UUID().uuidString, mode: .offer)
|
||||
callVC.conversationVC = self
|
||||
callVC.modalPresentationStyle = .overFullScreen
|
||||
callVC.modalTransitionStyle = .crossDissolve
|
||||
self.inputAccessoryView?.isHidden = true
|
||||
self.inputAccessoryView?.alpha = 0
|
||||
present(callVC, animated: true, completion: nil)
|
||||
} else {
|
||||
userDefaults[.hasSeenCallIPExposureWarning] = true
|
||||
showCallModal()
|
||||
}
|
||||
}
|
||||
|
||||
internal func showCallModal() {
|
||||
|
|
|
@ -6,6 +6,7 @@ public enum SNUserDefaults {
|
|||
case hasSyncedInitialConfiguration = "hasSyncedConfiguration"
|
||||
case hasViewedSeed
|
||||
case hasSeenLinkPreviewSuggestion
|
||||
case hasSeenCallIPExposureWarning
|
||||
case isUsingFullAPNs
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue