diff --git a/Session/Calls/Call Management/SessionCall.swift b/Session/Calls/Call Management/SessionCall.swift index 0f9890ad4..c8030090f 100644 --- a/Session/Calls/Call Management/SessionCall.swift +++ b/Session/Calls/Call Management/SessionCall.swift @@ -5,6 +5,9 @@ import PromiseKit import CallKit public final class SessionCall: NSObject, WebRTCSessionDelegate { + + @objc static let isEnabled = true + // MARK: Metadata Properties let uuid: String let callID: UUID // This is for CallKit diff --git a/Session/Conversations/ConversationVC+Interaction.swift b/Session/Conversations/ConversationVC+Interaction.swift index 9f7c54d8c..395c83890 100644 --- a/Session/Conversations/ConversationVC+Interaction.swift +++ b/Session/Conversations/ConversationVC+Interaction.swift @@ -28,6 +28,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 diff --git a/Session/Conversations/ConversationVC.swift b/Session/Conversations/ConversationVC.swift index c17e7150b..fccb1a69d 100644 --- a/Session/Conversations/ConversationVC.swift +++ b/Session/Conversations/ConversationVC.swift @@ -309,7 +309,7 @@ final class ConversationVC : BaseVC, ConversationViewModelDelegate, OWSConversat settingsButton.accessibilityLabel = "Settings button" settingsButton.isAccessibilityElement = true rightBarButtonItems.append(settingsButton) - let shouldShowCallButton = !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) + let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) if shouldShowCallButton { let callButton = UIBarButtonItem(image: UIImage(named: "Phone")!, style: .plain, target: self, action: #selector(startCall)) rightBarButtonItems.append(callButton) diff --git a/Session/Conversations/Views & Modals/ConversationTitleView.swift b/Session/Conversations/Views & Modals/ConversationTitleView.swift index b34e31a1c..33dfc43c3 100644 --- a/Session/Conversations/Views & Modals/ConversationTitleView.swift +++ b/Session/Conversations/Views & Modals/ConversationTitleView.swift @@ -44,7 +44,7 @@ final class ConversationTitleView : UIView { stackView.axis = .vertical stackView.alignment = .center stackView.isLayoutMarginsRelativeArrangement = true - let shouldShowCallButton = !thread.isNoteToSelf() && !thread.isGroupThread() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) + let shouldShowCallButton = SessionCall.isEnabled && !thread.isNoteToSelf() && !thread.isGroupThread() && (SSKPreferences.areCallsEnabled || !UserDefaults.standard[.hasSeenCallIPExposureWarning]) let leftMargin: CGFloat = shouldShowCallButton ? 54 : 8 // Contact threads also have the call button to compensate for stackView.layoutMargins = UIEdgeInsets(top: 0, left: leftMargin, bottom: 0, right: 0) addSubview(stackView)