|
|
|
@ -227,8 +227,6 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
blurView.isUserInteractionEnabled = false
|
|
|
|
|
self.view.addSubview(blurView)
|
|
|
|
|
|
|
|
|
|
self.view.setHLayoutMargins(0)
|
|
|
|
|
|
|
|
|
|
// Create the video views first, as they are under the other views.
|
|
|
|
|
createVideoViews()
|
|
|
|
|
createContactViews()
|
|
|
|
@ -276,7 +274,8 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
contactNameLabel.trailingBuffer = ScaleFromIPhone5(80.0)
|
|
|
|
|
|
|
|
|
|
// label config
|
|
|
|
|
contactNameLabel.font = UIFont.ows_lightFont(withSize: ScaleFromIPhone5To7Plus(32, 40))
|
|
|
|
|
contactNameLabel.font = UIFont.ows_dynamicTypeTitle1
|
|
|
|
|
contactNameLabel.textAlignment = .center
|
|
|
|
|
contactNameLabel.textColor = UIColor.white
|
|
|
|
|
contactNameLabel.layer.shadowOffset = CGSize.zero
|
|
|
|
|
contactNameLabel.layer.shadowOpacity = 0.35
|
|
|
|
@ -285,11 +284,13 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
self.view.addSubview(contactNameLabel)
|
|
|
|
|
|
|
|
|
|
callStatusLabel = UILabel()
|
|
|
|
|
callStatusLabel.font = UIFont.ows_regularFont(withSize: ScaleFromIPhone5To7Plus(19, 25))
|
|
|
|
|
callStatusLabel.font = UIFont.ows_dynamicTypeBody
|
|
|
|
|
callStatusLabel.textAlignment = .center
|
|
|
|
|
callStatusLabel.textColor = UIColor.white
|
|
|
|
|
callStatusLabel.layer.shadowOffset = CGSize.zero
|
|
|
|
|
callStatusLabel.layer.shadowOpacity = 0.35
|
|
|
|
|
callStatusLabel.layer.shadowRadius = 4
|
|
|
|
|
|
|
|
|
|
self.view.addSubview(callStatusLabel)
|
|
|
|
|
|
|
|
|
|
contactAvatarContainerView = UIView.container()
|
|
|
|
@ -358,8 +359,6 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
|
|
|
|
|
func createOngoingCallControls() {
|
|
|
|
|
|
|
|
|
|
// textMessageButton = createButton(imageName:"message-active-wide",
|
|
|
|
|
// action:#selector(didPressTextMessage))
|
|
|
|
|
audioSourceButton = createButton(image: #imageLiteral(resourceName: "audio-call-speaker-inactive"),
|
|
|
|
|
action: #selector(didPressAudioSource))
|
|
|
|
|
audioSourceButton.accessibilityLabel = NSLocalizedString("CALL_VIEW_AUDIO_SOURCE_LABEL",
|
|
|
|
@ -482,8 +481,10 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
|
|
|
|
|
// MARK: - Layout
|
|
|
|
|
|
|
|
|
|
var localVideoViewTopConstraint: NSLayoutConstraint!
|
|
|
|
|
|
|
|
|
|
func createViewConstraints() {
|
|
|
|
|
let topMargin = CGFloat(40)
|
|
|
|
|
|
|
|
|
|
let contactVSpacing = CGFloat(3)
|
|
|
|
|
let settingsNagHMargin = CGFloat(30)
|
|
|
|
|
let ongoingBottomMargin = ScaleFromIPhone5To7Plus(23, 41)
|
|
|
|
@ -501,27 +502,30 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
// Dark blurred background.
|
|
|
|
|
blurView.autoPinEdgesToSuperviewEdges()
|
|
|
|
|
|
|
|
|
|
localVideoView.autoPinTrailingToSuperviewMargin(withInset: videoPreviewHMargin)
|
|
|
|
|
localVideoView.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin)
|
|
|
|
|
let localVideoSize = ScaleFromIPhone5To7Plus(80, 100)
|
|
|
|
|
localVideoView.autoSetDimension(.width, toSize: localVideoSize)
|
|
|
|
|
localVideoView.autoSetDimension(.height, toSize: localVideoSize)
|
|
|
|
|
|
|
|
|
|
remoteVideoView.autoPinEdgesToSuperviewEdges()
|
|
|
|
|
|
|
|
|
|
leaveCallViewButton.autoPinEdge(toSuperviewMargin: .left)
|
|
|
|
|
leaveCallViewButton.autoPinEdge(toSuperviewEdge: .top, withInset: topMargin)
|
|
|
|
|
leaveCallViewButton.autoPinEdge(toSuperviewMargin: .leading)
|
|
|
|
|
leaveCallViewButton.autoPinEdge(toSuperviewMargin: .top)
|
|
|
|
|
|
|
|
|
|
contactNameLabel.autoPinEdge(.top, to: .bottom, of: leaveCallViewButton, withOffset: 8)
|
|
|
|
|
contactNameLabel.autoPinLeadingToSuperviewMargin()
|
|
|
|
|
// MJK TODO height of contact name label should be ~same as back button
|
|
|
|
|
contactNameLabel.autoPinEdge(toSuperviewMargin: .top)
|
|
|
|
|
contactNameLabel.autoPinEdge(.leading, to: .trailing, of: leaveCallViewButton, withOffset: 8, relation: .greaterThanOrEqual)
|
|
|
|
|
contactNameLabel.autoHCenterInSuperview()
|
|
|
|
|
contactNameLabel.setContentHuggingVerticalHigh()
|
|
|
|
|
contactNameLabel.setCompressionResistanceHigh()
|
|
|
|
|
|
|
|
|
|
callStatusLabel.autoPinEdge(.top, to: .bottom, of: contactNameLabel, withOffset: contactVSpacing)
|
|
|
|
|
callStatusLabel.autoPinLeadingToSuperviewMargin()
|
|
|
|
|
callStatusLabel.autoHCenterInSuperview()
|
|
|
|
|
callStatusLabel.setContentHuggingVerticalHigh()
|
|
|
|
|
callStatusLabel.setCompressionResistanceHigh()
|
|
|
|
|
|
|
|
|
|
localVideoView.autoPinTrailingToSuperviewMargin(withInset: videoPreviewHMargin)
|
|
|
|
|
// MJK TODO, depends on whether contactNameLabel is visible
|
|
|
|
|
self.localVideoViewTopConstraint = localVideoView.autoPinEdge(.top, to: .bottom, of: callStatusLabel, withOffset: 4)
|
|
|
|
|
let localVideoSize = ScaleFromIPhone5To7Plus(80, 100)
|
|
|
|
|
localVideoView.autoSetDimension(.width, toSize: localVideoSize)
|
|
|
|
|
localVideoView.autoSetDimension(.height, toSize: localVideoSize)
|
|
|
|
|
|
|
|
|
|
remoteVideoView.autoPinEdgesToSuperviewEdges()
|
|
|
|
|
|
|
|
|
|
contactAvatarContainerView.autoPinEdge(.top, to: .bottom, of: callStatusLabel, withOffset: +avatarTopSpacing)
|
|
|
|
|
contactAvatarContainerView.autoPinEdge(.bottom, to: .top, of: ongoingCallControls, withOffset: -avatarBottomSpacing)
|
|
|
|
|
contactAvatarContainerView.autoPinWidthToSuperview(withMargin: avatarTopSpacing)
|
|
|
|
@ -577,12 +581,12 @@ class CallViewController: OWSViewController, CallObserver, CallServiceObserver,
|
|
|
|
|
|
|
|
|
|
if localVideoView.isHidden {
|
|
|
|
|
let contactHMargin = CGFloat(5)
|
|
|
|
|
constraints.append(contactNameLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
|
|
|
|
|
constraints.append(callStatusLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
|
|
|
|
|
// constraints.append(contactNameLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
|
|
|
|
|
// constraints.append(callStatusLabel.autoPinTrailingToSuperviewMargin(withInset: contactHMargin))
|
|
|
|
|
} else {
|
|
|
|
|
let spacing = CGFloat(10)
|
|
|
|
|
constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: contactNameLabel, offset: spacing))
|
|
|
|
|
constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: callStatusLabel, offset: spacing))
|
|
|
|
|
// constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: contactNameLabel, offset: spacing))
|
|
|
|
|
// constraints.append(localVideoView.autoPinLeading(toTrailingEdgeOf: callStatusLabel, offset: spacing))
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
self.localVideoConstraints = constraints
|
|
|
|
|