Commit ff7b266b authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

UI: add speakerphone button for video call

Change-Id: I9bb1e61434ca1197d14cf98571501b703a0aacb5
parent 8d3c570b
......@@ -32,9 +32,9 @@ class ButtonsContainerView: UIView, NibLoadable {
@IBOutlet weak var muteAudioButton: UIButton!
@IBOutlet weak var muteVideoButton: UIButton!
@IBOutlet weak var pauseCallButton: UIButton!
@IBOutlet weak var switchCameraButton: UIButton!
@IBOutlet weak var switchSpeakerButton: UIButton!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var spaceButton: UIButton!
//Constraints
@IBOutlet weak var cancelButtonWidthConstraint: NSLayoutConstraint!
......@@ -90,7 +90,6 @@ class ButtonsContainerView: UIView, NibLoadable {
muteAudioButton.isHidden = true
muteVideoButton.isHidden = true
pauseCallButton.isHidden = true
switchCameraButton.isHidden = true
switchSpeakerButton.isHidden = true
cancelButton.isHidden = false
}
......@@ -102,14 +101,11 @@ class ButtonsContainerView: UIView, NibLoadable {
muteAudioButton.isHidden = false
if self.viewModel?.isAudioOnly ?? false {
muteVideoButton.isHidden = true
switchCameraButton.isHidden = true
spaceButton.isHidden = true
} else {
muteVideoButton.isHidden = false
switchCameraButton.isHidden = false
}
pauseCallButton.isHidden = false
switchSpeakerButton.isHidden = false
switchSpeakerButton.alpha = 1.00
switchSpeakerButton.isEnabled = true
cancelButton.isHidden = false
}
......@@ -120,13 +116,11 @@ class ButtonsContainerView: UIView, NibLoadable {
self.isCallStarted = true
if self.viewModel?.isAudioOnly ?? false {
muteVideoButton.isHidden = true
switchCameraButton.isHidden = true
switchSpeakerButton.isHidden = true
spaceButton.isHidden = true
} else {
muteVideoButton.isHidden = false
switchCameraButton.isHidden = false
switchSpeakerButton.isHidden = false
}
switchSpeakerButton.isEnabled = false
self.muteAudioButton.isHidden = false
self.backgroundBlurEffect.isHidden = false
pauseCallButton.isHidden = false
......
......@@ -23,10 +23,10 @@
<outlet property="muteAudioButton" destination="tXL-FB-O0X" id="6Bh-x3-veQ"/>
<outlet property="muteVideoButton" destination="W7F-nH-kda" id="MWK-JU-544"/>
<outlet property="pauseCallButton" destination="MPk-dB-dhR" id="W4G-AB-WFw"/>
<outlet property="spaceButton" destination="L9n-Zc-bLI" id="92r-Og-oN0"/>
<outlet property="stackView" destination="RHx-cL-CV5" id="Iz9-B0-2Rd"/>
<outlet property="stackViewWidthConstraint" destination="ZuV-LV-CYZ" id="ita-8Y-fAb"/>
<outlet property="stackViewYConstraint" destination="z8B-uv-Vcb" id="Gaj-8x-yif"/>
<outlet property="switchCameraButton" destination="gfb-nb-FyB" id="FTM-2Z-u3u"/>
<outlet property="switchSpeakerButton" destination="0VH-mO-vFE" id="1Gy-a9-FAW"/>
</connections>
</placeholder>
......@@ -97,19 +97,18 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0VH-mO-vFE">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="L9n-Zc-bLI">
<rect key="frame" x="147.5" y="0.0" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="oso-jU-2U3"/>
<constraint firstAttribute="height" constant="50" id="qmE-To-ipl"/>
<constraint firstAttribute="height" constant="50" id="37P-Oz-QCS"/>
<constraint firstAttribute="width" constant="50" id="wS1-Dk-uHm"/>
</constraints>
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" image="disable_speakerphone"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="2"/>
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="NO"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="25"/>
</userDefinedRuntimeAttribute>
......@@ -139,25 +138,25 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="gfb-nb-FyB">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="0VH-mO-vFE">
<rect key="frame" x="295" y="0.0" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="DYV-x7-KoO"/>
<constraint firstAttribute="width" constant="50" id="XYg-b8-pt8"/>
<constraint firstAttribute="width" constant="50" id="oso-jU-2U3"/>
<constraint firstAttribute="height" constant="50" id="qmE-To-ipl"/>
</constraints>
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" image="switch_camera"/>
<state key="normal" image="disable_speakerphone"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="2"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="25"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</button>
</subviews>
......@@ -221,7 +220,6 @@
<image name="disable_speakerphone" width="48" height="48"/>
<image name="pause_call" width="48" height="48"/>
<image name="stop_call" width="48" height="48"/>
<image name="switch_camera" width="50" height="37"/>
<image name="video_running" width="48" height="48"/>
<image name="video_running" width="43.5" height="43.5"/>
</resources>
</document>
......@@ -148,13 +148,36 @@
<constraint firstAttribute="height" constant="70" id="iha-aS-TZH"/>
</constraints>
</imageView>
<button hidden="YES" opaque="NO" contentMode="scaleAspectFit" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="223-1E-riv">
<rect key="frame" x="162.66666666666666" y="403.66666666666669" width="50" height="50"/>
<constraints>
<constraint firstAttribute="width" constant="50" id="MN0-Eh-bIu"/>
<constraint firstAttribute="height" constant="50" id="xms-0h-ZuM"/>
</constraints>
<color key="tintColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<state key="normal" image="switch_camera"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="0.0"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="NO"/>
</userDefinedRuntimeAttributes>
</button>
</subviews>
<constraints>
<constraint firstItem="gWE-IS-b5p" firstAttribute="centerY" secondItem="rt7-JS-vjg" secondAttribute="centerY" id="1Jq-i7-iGP"/>
<constraint firstItem="CfE-DF-buX" firstAttribute="centerX" secondItem="ZK1-Be-lcD" secondAttribute="centerX" id="51a-aO-iap"/>
<constraint firstItem="223-1E-riv" firstAttribute="centerX" secondItem="ZK1-Be-lcD" secondAttribute="centerX" id="KH5-fw-hla"/>
<constraint firstItem="CfE-DF-buX" firstAttribute="height" secondItem="ZK1-Be-lcD" secondAttribute="height" id="O6Q-I4-gU3"/>
<constraint firstItem="rt7-JS-vjg" firstAttribute="centerX" secondItem="CfE-DF-buX" secondAttribute="centerX" id="QPi-iO-gGH"/>
<constraint firstItem="rt7-JS-vjg" firstAttribute="width" secondItem="CfE-DF-buX" secondAttribute="width" id="VX9-wH-CfO"/>
<constraint firstItem="223-1E-riv" firstAttribute="centerY" secondItem="ZK1-Be-lcD" secondAttribute="centerY" id="cb4-Jh-zso"/>
<constraint firstItem="rt7-JS-vjg" firstAttribute="height" secondItem="CfE-DF-buX" secondAttribute="height" id="glm-Va-dTY"/>
<constraint firstItem="gWE-IS-b5p" firstAttribute="leading" secondItem="rt7-JS-vjg" secondAttribute="leading" constant="-17" id="kOS-1k-vY1"/>
<constraint firstItem="CfE-DF-buX" firstAttribute="centerY" secondItem="ZK1-Be-lcD" secondAttribute="centerY" id="pDf-fu-Le6"/>
......@@ -334,6 +357,7 @@
<outlet property="profileImageViewHeightConstraint" destination="V9c-7W-Frv" id="0iC-TD-RuH"/>
<outlet property="profileImageViewWidthConstraint" destination="Miw-Nd-4Fa" id="OSp-7J-TGC"/>
<outlet property="spinner" destination="nwA-ao-thv" id="bJo-Wq-QmV"/>
<outlet property="switchCameraButton" destination="223-1E-riv" id="0Pd-fI-JIR"/>
<outlet property="viewCapturedVideo" destination="ZK1-Be-lcD" id="Go0-ab-yLg"/>
</connections>
</viewController>
......@@ -345,5 +369,6 @@
<resources>
<image name="ic_contact_picture" width="512" height="512"/>
<image name="left_arrow" width="138.24000549316406" height="138.24000549316406"/>
<image name="switch_camera" width="100" height="100"/>
</resources>
</document>
......@@ -37,6 +37,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
@IBOutlet weak var avatarView: UIView!
@IBOutlet weak var avatarViewBlurEffect: UIVisualEffectView!
@IBOutlet private weak var callPulse: UIView!
@IBOutlet weak var switchCameraButton: UIButton!
@IBOutlet private weak var mainView: UIView!
......@@ -122,6 +123,8 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
UIDevice.current.isProximityMonitoringEnabled = self.viewModel.isAudioOnly
switchCameraButton.contentVerticalAlignment = .fill
switchCameraButton.contentHorizontalAlignment = .fill
initCallAnimation()
UIApplication.shared.isIdleTimerDisabled = true
......@@ -201,7 +204,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self?.viewModel.togglePauseCall()
}).disposed(by: self.disposeBag)
self.buttonsContainer.switchCameraButton.rx.tap
self.switchCameraButton.rx.tap
.subscribe(onNext: { [weak self] in
self?.viewModel.switchCamera()
}).disposed(by: self.disposeBag)
......@@ -241,7 +244,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}).disposed(by: self.disposeBag)
// disable switch camera button for audio only calls
self.buttonsContainer.switchCameraButton.isEnabled = !(self.viewModel.isAudioOnly)
self.switchCameraButton.isEnabled = !(self.viewModel.isAudioOnly)
}
func setupBindings() {
......@@ -576,6 +579,10 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
self.isMenuShowed = true
self.buttonsContainer.isHidden = false
if !self.capturedVideo.isHidden {
self.switchCameraButton.isHidden = false
}
self.infoContainer.isHidden = false
self.view.layoutIfNeeded()
......@@ -590,6 +597,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
} else {
self?.buttonsContainerBottomConstraint.constant = 10
}
self?.capturedVideoBlurEffect.alpha = 0.7
self?.view.layoutIfNeeded()
})
......@@ -600,7 +608,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
func hideContactInfo() {
self.isMenuShowed = false
UIView.animate(withDuration: 0.2, animations: { [unowned self] in
if self.isVideoHidden { self.capturedVideoBlurEffect.alpha = 1 }
self.capturedVideoBlurEffect.alpha = self.isVideoHidden ? 1 : 0
self.resizeCapturedVideo(withInfoContainer: false)
self.infoContainerTopConstraint.constant = 150
self.buttonsContainerBottomConstraint.constant = -150
......@@ -608,6 +616,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}, completion: { [weak self] _ in
self?.infoContainer.isHidden = true
self?.buttonsContainer.isHidden = true
self?.switchCameraButton.isHidden = true
})
}
......
......@@ -2,5 +2,8 @@
"info" : {
"version" : 1,
"author" : "xcode"
},
"properties" : {
"compression-type" : "lossy"
}
}
\ No newline at end of file
......@@ -2,17 +2,17 @@
"images" : [
{
"idiom" : "universal",
"filename" : "Icon-29.png",
"filename" : "icons8-rotate_180.png",
"scale" : "1x"
},
{
"idiom" : "universal",
"filename" : "Icon-48.png",
"filename" : "icons8-rotate_180-1.png",
"scale" : "2x"
},
{
"idiom" : "universal",
"filename" : "Icon-72.png",
"filename" : "icons8-rotate_180-2.png",
"scale" : "3x"
}
],
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment