From 9e34f87f0d7304447a9defb42707456b96b27263 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 30 Jan 2017 09:43:48 -0500 Subject: [PATCH 1/2] Fix issues around how remote/local video states affect call view. // FREEBIE --- .../view controllers/CallViewController.swift | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/Signal/src/view controllers/CallViewController.swift b/Signal/src/view controllers/CallViewController.swift index 9d99ee591..bd87da5e9 100644 --- a/Signal/src/view controllers/CallViewController.swift +++ b/Signal/src/view controllers/CallViewController.swift @@ -458,6 +458,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R } self.localVideoConstraints = constraints + updateCallUI(callState: call.state) } // MARK: - Methods @@ -546,12 +547,17 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R ongoingCallView.isUserInteractionEnabled = !isRinging // Rework control state if remote video is available. - contactAvatarView.isHidden = !remoteVideoView.isHidden - speakerPhoneButton.isHidden = !remoteVideoView.isHidden - audioModeMuteButton.isHidden = !remoteVideoView.isHidden - videoModeMuteButton.isHidden = remoteVideoView.isHidden - audioModeVideoButton.isHidden = !remoteVideoView.isHidden - videoModeVideoButton.isHidden = remoteVideoView.isHidden + let hasRemoteVideo = !remoteVideoView.isHidden + contactAvatarView.isHidden = hasRemoteVideo + + // Rework control state if local video is available. + let hasLocalVideo = !localVideoView.isHidden + for subview in [speakerPhoneButton, audioModeMuteButton, audioModeVideoButton] { + subview?.isHidden = hasLocalVideo + } + for subview in [videoModeMuteButton, videoModeVideoButton] { + subview?.isHidden = !hasLocalVideo + } // Also hide other controls if user has tapped to hide them. if areRemoteVideoControlsHidden && !remoteVideoView.isHidden { From 40d79441203f48227d575c7b6298f69c89714b71 Mon Sep 17 00:00:00 2001 From: Matthew Chen Date: Mon, 30 Jan 2017 14:06:57 -0500 Subject: [PATCH 2/2] Respond to CR. // FREEBIE --- Signal/src/view controllers/CallViewController.swift | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Signal/src/view controllers/CallViewController.swift b/Signal/src/view controllers/CallViewController.swift index bd87da5e9..458722176 100644 --- a/Signal/src/view controllers/CallViewController.swift +++ b/Signal/src/view controllers/CallViewController.swift @@ -73,7 +73,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R var remoteVideoConstraints: [NSLayoutConstraint] = [] var localVideoConstraints: [NSLayoutConstraint] = [] - var areRemoteVideoControlsHidden = false { + var shouldRemoteVideoControlsBeHidden = false { didSet { updateCallUI(callState: call.state) } @@ -164,7 +164,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R func didTouchRootView(sender: UIGestureRecognizer) { if !remoteVideoView.isHidden { - areRemoteVideoControlsHidden = !areRemoteVideoControlsHidden + shouldRemoteVideoControlsBeHidden = !shouldRemoteVideoControlsBeHidden } } @@ -560,7 +560,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R } // Also hide other controls if user has tapped to hide them. - if areRemoteVideoControlsHidden && !remoteVideoView.isHidden { + if shouldRemoteVideoControlsBeHidden && !remoteVideoView.isHidden { contactNameLabel.isHidden = true callStatusLabel.isHidden = true ongoingCallView.isHidden = true @@ -742,7 +742,7 @@ class CallViewController: UIViewController, CallObserver, CallServiceObserver, R remoteVideoView.renderFrame(nil) self.remoteVideoTrack = remoteVideoTrack self.remoteVideoTrack?.add(remoteVideoView) - areRemoteVideoControlsHidden = false + shouldRemoteVideoControlsBeHidden = false if remoteVideoTrack == nil { remoteVideoSize = CGSize.zero