clean up call button appearance logic

pull/560/head
Ryan Zhao 3 years ago
parent 42b7c0eebd
commit b2b03eb273

@ -29,11 +29,7 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
// MARK: Call
@objc func startCall(_ sender: Any?) {
guard SessionCall.isEnabled else { return }
let userDefaults = UserDefaults.standard
if !SSKPreferences.areCallsEnabled && !userDefaults[.hasSeenCallIPExposureWarning] {
userDefaults[.hasSeenCallIPExposureWarning] = true
showCallModal()
} else if SSKPreferences.areCallsEnabled {
if SSKPreferences.areCallsEnabled {
requestMicrophonePermissionIfNeeded { }
guard AVAudioSession.sharedInstance().recordPermission == .granted else { return }
guard let contactSessionID = (thread as? TSContactThread)?.contactSessionID() else { return }
@ -47,13 +43,6 @@ extension ConversationVC : InputViewDelegate, MessageCellDelegate, ContextMenuAc
}
}
internal func showCallModal() {
let callModal = CallModal() { [weak self] in
self?.startCall(nil)
}
present(callModal, animated: true, completion: nil)
}
internal func showCallVCIfNeeded() {
guard let incomingCallBanner = IncomingCallBanner.current else { return }
incomingCallBanner.showCallVC(answer: false)

@ -309,7 +309,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat
settingsButton.accessibilityLabel = "Settings button"
settingsButton.isAccessibilityElement = true
rightBarButtonItems.append(settingsButton)
let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning])
let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && SSKPreferences.areCallsEnabled
if shouldShowCallButton {
let callButton = UIBarButtonItem(image: UIImage(named: "Phone")!, style: .plain, target: self, action: #selector(startCall))
rightBarButtonItems.append(callButton)

Loading…
Cancel
Save