mirror of
https://github.com/oxen-io/session-ios.git
synced 2023-12-13 21:30:14 +01:00
add flag for enable/disable call function
This commit is contained in:
parent
6ac075fa5a
commit
71e6ccd94b
4 changed files with 6 additions and 2 deletions
|
@ -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
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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)
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Reference in a new issue