Commit 0ccf6e2f authored by Kateryna Kostiuk's avatar Kateryna Kostiuk

UI: show call options

Keep call options visible unless screen is tapped

Change-Id: Ie5a3dd80e08d656c9315a86c6eb3853a0fe91fcd
parent d7781045
......@@ -35,10 +35,13 @@ class ButtonsContainerView: UIView, NibLoadable {
@IBOutlet weak var dialpadButton: UIButton!
@IBOutlet weak var switchSpeakerButton: UIButton!
@IBOutlet weak var cancelButton: UIButton!
@IBOutlet weak var spaceButton: UIButton!
//@IBOutlet weak var spaceButton: UIButton!
@IBOutlet weak var switchCameraButton: UIButton!
//Constraints
@IBOutlet weak var cancelButtonWidthConstraint: NSLayoutConstraint!
@IBOutlet weak var cancelButtonCenterConstraint: NSLayoutConstraint!
@IBOutlet weak var cancelButtonRightAlligmentConstraint: NSLayoutConstraint!
@IBOutlet weak var cancelButtonBottomConstraint: NSLayoutConstraint!
@IBOutlet weak var cancelButtonHeightConstraint: NSLayoutConstraint!
@IBOutlet weak var stackViewYConstraint: NSLayoutConstraint!
......@@ -83,17 +86,22 @@ class ButtonsContainerView: UIView, NibLoadable {
Bundle.main.loadNibNamed("ButtonsContainerView", owner: self, options: nil)
addSubview(containerView)
containerView.frame = self.bounds
self.container.clipsToBounds = false
}
func withoutOptions() {
self.container.backgroundColor = UIColor.clear
self.backgroundBlurEffect.isHidden = true
switchCameraButton.isHidden = true
muteAudioButton.isHidden = true
muteVideoButton.isHidden = true
pauseCallButton.isHidden = true
dialpadButton.isHidden = true
switchSpeakerButton.isHidden = true
cancelButton.isHidden = false
cancelButtonBottomConstraint.constant = 20
cancelButtonRightAlligmentConstraint.priority = UILayoutPriority(rawValue: 250.0)
cancelButtonCenterConstraint.priority = UILayoutPriority(rawValue: 999.0)
}
func optionsWithSpeaker() {
......@@ -103,12 +111,19 @@ class ButtonsContainerView: UIView, NibLoadable {
muteAudioButton.isHidden = false
if self.viewModel?.isAudioOnly ?? false {
muteVideoButton.isHidden = true
spaceButton.isHidden = true
switchCameraButton.isHidden = true
if self.viewModel?.isSipCall ?? false {
dialpadButton.isHidden = false
}
cancelButtonBottomConstraint.constant = 20
cancelButtonRightAlligmentConstraint.priority = UILayoutPriority(rawValue: 250.0)
cancelButtonCenterConstraint.priority = UILayoutPriority(rawValue: 999.0)
} else {
muteVideoButton.isHidden = false
switchCameraButton.isHidden = false
cancelButtonBottomConstraint.constant = 120
cancelButtonCenterConstraint.priority = UILayoutPriority(rawValue: 250.0)
cancelButtonRightAlligmentConstraint.priority = UILayoutPriority(rawValue: 999.0)
}
pauseCallButton.isHidden = false
switchSpeakerButton.isEnabled = true
......@@ -122,12 +137,19 @@ class ButtonsContainerView: UIView, NibLoadable {
self.isCallStarted = true
if self.viewModel?.isAudioOnly ?? false {
muteVideoButton.isHidden = true
spaceButton.isHidden = true
switchCameraButton.isHidden = true
if self.viewModel?.isSipCall ?? false {
dialpadButton.isHidden = false
}
cancelButtonBottomConstraint.constant = 20
cancelButtonRightAlligmentConstraint.priority = UILayoutPriority(rawValue: 250.0)
cancelButtonCenterConstraint.priority = UILayoutPriority(rawValue: 999.0)
} else {
switchCameraButton.isHidden = false
muteVideoButton.isHidden = false
cancelButtonBottomConstraint.constant = 120
cancelButtonCenterConstraint.priority = UILayoutPriority(rawValue: 250.0)
cancelButtonRightAlligmentConstraint.priority = UILayoutPriority(rawValue: 999.0)
}
switchSpeakerButton.isEnabled = false
self.muteAudioButton.isHidden = false
......
......@@ -13,9 +13,11 @@
<placeholder placeholderIdentifier="IBFilesOwner" id="-1" userLabel="File's Owner" customClass="ButtonsContainerView" customModule="Ring" customModuleProvider="target">
<connections>
<outlet property="backgroundBlurEffect" destination="w5l-pw-1ET" id="YYh-qB-WIL"/>
<outlet property="cancelButton" destination="ZxT-mA-1xU" id="68q-sF-gBC"/>
<outlet property="cancelButton" destination="ZxT-mA-1xU" id="4nk-iI-vPV"/>
<outlet property="cancelButtonBottomConstraint" destination="Ilu-Zu-JqW" id="Yeg-Ca-8pf"/>
<outlet property="cancelButtonCenterConstraint" destination="ls1-Ze-LXF" id="C7A-Xr-QqX"/>
<outlet property="cancelButtonHeightConstraint" destination="kls-aA-2zS" id="CzE-vC-V5Z"/>
<outlet property="cancelButtonRightAlligmentConstraint" destination="E6D-cY-KlH" id="6nx-eq-uuw"/>
<outlet property="cancelButtonWidthConstraint" destination="0vV-4C-odp" id="beL-yR-ehA"/>
<outlet property="container" destination="a9g-pf-bHy" id="6bw-CB-5qN"/>
<outlet property="containerHeightConstraint" destination="Gjk-7U-rEe" id="G5G-Uh-zRV"/>
......@@ -24,10 +26,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="RJW-4D-bPR" id="74c-XD-hdA"/>
<outlet property="switchSpeakerButton" destination="0VH-mO-vFE" id="1Gy-a9-FAW"/>
</connections>
</placeholder>
......@@ -37,14 +39,17 @@
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
<subviews>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="a9g-pf-bHy">
<rect key="frame" x="0.0" y="-2" width="375" height="110"/>
<rect key="frame" x="0.0" y="-92" width="375" height="200"/>
<subviews>
<visualEffectView opaque="NO" contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="w5l-pw-1ET" userLabel="Background Blur Effect">
<rect key="frame" x="0.0" y="0.0" width="375" height="110"/>
<rect key="frame" x="0.0" y="90" width="375" height="110"/>
<view key="contentView" opaque="NO" clipsSubviews="YES" multipleTouchEnabled="YES" contentMode="center" insetsLayoutMarginsFromSafeArea="NO" id="JSn-50-Cd9">
<rect key="frame" x="0.0" y="0.0" width="375" height="110"/>
<autoresizingMask key="autoresizingMask" widthSizable="YES" heightSizable="YES"/>
</view>
<constraints>
<constraint firstAttribute="height" constant="110" id="Y2W-3d-8DC"/>
</constraints>
<blurEffect style="light"/>
<userDefinedRuntimeAttributes>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
......@@ -54,7 +59,7 @@
</userDefinedRuntimeAttributes>
</visualEffectView>
<stackView opaque="NO" contentMode="scaleToFill" distribution="equalSpacing" alignment="center" translatesAutoresizingMaskIntoConstraints="NO" id="RHx-cL-CV5">
<rect key="frame" x="15" y="30" width="345" height="50"/>
<rect key="frame" x="15" y="120" width="345" height="50"/>
<subviews>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="tXL-FB-O0X">
<rect key="frame" x="0.0" y="0.0" width="50" height="50"/>
......@@ -98,21 +103,22 @@
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
</button>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="L9n-Zc-bLI">
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="RJW-4D-bPR">
<rect key="frame" x="147.5" y="0.0" width="50" height="50"/>
<constraints>
<constraint firstAttribute="height" constant="50" id="37P-Oz-QCS"/>
<constraint firstAttribute="width" constant="50" id="wS1-Dk-uHm"/>
<constraint firstAttribute="height" constant="50" id="DRc-Jz-wSo"/>
<constraint firstAttribute="width" constant="50" id="R9j-nN-Ez6"/>
</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="boolean" keyPath="roundedCorners" value="NO"/>
<userDefinedRuntimeAttribute type="boolean" keyPath="roundedCorners" value="YES"/>
<userDefinedRuntimeAttribute type="number" keyPath="cornerRadius">
<real key="value" value="25"/>
</userDefinedRuntimeAttribute>
<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>
......@@ -189,7 +195,7 @@
</constraints>
</stackView>
<button opaque="NO" contentMode="scaleToFill" contentHorizontalAlignment="center" contentVerticalAlignment="center" lineBreakMode="middleTruncation" translatesAutoresizingMaskIntoConstraints="NO" id="ZxT-mA-1xU">
<rect key="frame" x="152.5" y="20" width="70" height="70"/>
<rect key="frame" x="290" y="10" width="70" height="70"/>
<constraints>
<constraint firstAttribute="width" constant="70" id="0vV-4C-odp"/>
<constraint firstAttribute="height" constant="70" id="kls-aA-2zS"/>
......@@ -211,16 +217,16 @@
</subviews>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstItem="w5l-pw-1ET" firstAttribute="height" secondItem="a9g-pf-bHy" secondAttribute="height" id="3vF-Mr-YlI"/>
<constraint firstAttribute="height" constant="110" id="Gjk-7U-rEe"/>
<constraint firstAttribute="bottom" secondItem="ZxT-mA-1xU" secondAttribute="bottom" constant="20" id="Ilu-Zu-JqW"/>
<constraint firstItem="w5l-pw-1ET" firstAttribute="centerY" secondItem="a9g-pf-bHy" secondAttribute="centerY" id="Key-mX-9mY"/>
<constraint firstAttribute="bottom" secondItem="w5l-pw-1ET" secondAttribute="bottom" id="6qu-Nn-b1Y"/>
<constraint firstItem="ZxT-mA-1xU" firstAttribute="trailing" secondItem="RHx-cL-CV5" secondAttribute="trailing" priority="999" id="E6D-cY-KlH"/>
<constraint firstAttribute="height" constant="200" id="Gjk-7U-rEe"/>
<constraint firstAttribute="bottom" secondItem="ZxT-mA-1xU" secondAttribute="bottom" constant="120" id="Ilu-Zu-JqW"/>
<constraint firstAttribute="trailing" secondItem="w5l-pw-1ET" secondAttribute="trailing" id="TnQ-lp-9B9"/>
<constraint firstItem="RHx-cL-CV5" firstAttribute="leading" secondItem="a9g-pf-bHy" secondAttribute="leading" constant="15" id="Y9c-4n-eid"/>
<constraint firstAttribute="width" relation="lessThanOrEqual" constant="450" id="ZfR-cx-MUB"/>
<constraint firstItem="w5l-pw-1ET" firstAttribute="leading" secondItem="a9g-pf-bHy" secondAttribute="leading" id="bbd-5D-5So"/>
<constraint firstItem="RHx-cL-CV5" firstAttribute="centerX" secondItem="a9g-pf-bHy" secondAttribute="centerX" id="bmE-qo-8aJ"/>
<constraint firstItem="ZxT-mA-1xU" firstAttribute="centerX" secondItem="a9g-pf-bHy" secondAttribute="centerX" id="eV9-Wr-xF9"/>
<constraint firstItem="ZxT-mA-1xU" firstAttribute="centerX" secondItem="a9g-pf-bHy" secondAttribute="centerX" priority="250" id="ls1-Ze-LXF"/>
<constraint firstAttribute="trailing" secondItem="RHx-cL-CV5" secondAttribute="trailing" constant="15" id="pgj-7m-5gr"/>
<constraint firstAttribute="bottom" secondItem="RHx-cL-CV5" secondAttribute="bottom" constant="30" id="z8B-uv-Vcb"/>
</constraints>
......@@ -243,6 +249,7 @@
<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="50"/>
<image name="video_running" width="43.5" height="43.5"/>
</resources>
</document>
......@@ -148,36 +148,13 @@
<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"/>
......@@ -263,7 +240,7 @@
<nil key="highlightedColor"/>
</label>
<label opaque="NO" userInteractionEnabled="NO" contentMode="left" horizontalHuggingPriority="251" verticalHuggingPriority="251" text="" textAlignment="natural" lineBreakMode="tailTruncation" numberOfLines="0" baselineAdjustment="alignBaselines" adjustsFontSizeToFit="NO" translatesAutoresizingMaskIntoConstraints="NO" id="SdV-jx-Mla">
<rect key="frame" x="187.66666666666666" y="658" width="0.0" height="0.0"/>
<rect key="frame" x="187.66666666666666" y="648" width="0.0" height="0.0"/>
<fontDescription key="fontDescription" type="system" pointSize="20"/>
<color key="textColor" red="0.0" green="0.0" blue="0.0" alpha="0.5" colorSpace="custom" customColorSpace="sRGB"/>
<nil key="highlightedColor"/>
......@@ -293,10 +270,10 @@
</constraints>
</view>
<view contentMode="scaleToFill" translatesAutoresizingMaskIntoConstraints="NO" id="LK6-u0-eLU" customClass="ButtonsContainerView" customModule="Ring" customModuleProvider="target">
<rect key="frame" x="10" y="658" width="355" height="110"/>
<rect key="frame" x="10" y="568" width="355" height="200"/>
<color key="backgroundColor" white="0.0" alpha="0.0" colorSpace="calibratedWhite"/>
<constraints>
<constraint firstAttribute="height" constant="110" id="r58-OO-QqE"/>
<constraint firstAttribute="height" constant="200" id="r58-OO-QqE"/>
</constraints>
</view>
</subviews>
......@@ -313,7 +290,7 @@
<constraint firstItem="5E0-lB-SkS" firstAttribute="height" secondItem="QpJ-Sx-9dG" secondAttribute="height" id="KFS-O1-Acs"/>
<constraint firstItem="ZVy-nB-bKJ" firstAttribute="top" secondItem="QpJ-Sx-9dG" secondAttribute="top" id="NrK-DR-BPG"/>
<constraint firstItem="lZI-X0-bkP" firstAttribute="top" secondItem="ZK1-Be-lcD" secondAttribute="top" constant="45" id="Uew-ao-q8k"/>
<constraint firstItem="SdV-jx-Mla" firstAttribute="bottom" secondItem="LK6-u0-eLU" secondAttribute="top" id="YIc-Oj-lc8"/>
<constraint firstItem="SdV-jx-Mla" firstAttribute="bottom" secondItem="LK6-u0-eLU" secondAttribute="top" constant="80" id="YIc-Oj-lc8"/>
<constraint firstItem="ZVy-nB-bKJ" firstAttribute="centerY" secondItem="QpJ-Sx-9dG" secondAttribute="centerY" id="bAN-gX-nPE"/>
<constraint firstItem="lZI-X0-bkP" firstAttribute="trailing" secondItem="LK6-u0-eLU" secondAttribute="trailing" constant="10" id="cl9-Fw-bSb"/>
<constraint firstItem="ZVy-nB-bKJ" firstAttribute="centerX" secondItem="lZI-X0-bkP" secondAttribute="centerX" id="ff0-Nw-f2Y"/>
......@@ -357,7 +334,6 @@
<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>
......@@ -369,6 +345,5 @@
<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="75" height="75"/>
</resources>
</document>
......@@ -38,7 +38,6 @@ 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!
......@@ -80,9 +79,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
fileprivate let disposeBag = DisposeBag()
private let log = SwiftyBeaver.self
private var task: DispatchWorkItem?
private var shouldRotateScreen = false
override var preferredStatusBarStyle: UIStatusBarStyle {
......@@ -124,8 +120,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
UIDevice.current.isProximityMonitoringEnabled = self.viewModel.isAudioOnly
switchCameraButton.contentVerticalAlignment = .fill
switchCameraButton.contentHorizontalAlignment = .fill
initCallAnimation()
UIApplication.shared.isIdleTimerDisabled = true
......@@ -180,6 +174,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
func setUpCallButtons() {
self.mainView.bringSubview(toFront: self.buttonsContainer)
self.buttonsContainer.viewModel = self.viewModel.containerViewModel
self.buttonsContainer.cancelButton.rx.tap
.subscribe(onNext: { [weak self] in
......@@ -189,10 +184,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self.buttonsContainer.dialpadButton.rx.tap
.subscribe(onNext: { [weak self] in
// guard let bag = self?.viewModel.injectionBag else {return}
// let dialpadViewController = DialpadViewController.instantiate(with: bag)
// dialpadViewController.viewModel.inCallDialpad = true
// self?.present(dialpadViewController, animated: true, completion: nil)
self?.viewModel.showDialpad()
}).disposed(by: self.disposeBag)
......@@ -213,7 +204,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self?.viewModel.togglePauseCall()
}).disposed(by: self.disposeBag)
self.switchCameraButton.rx.tap
self.buttonsContainer.switchCameraButton.rx.tap
.subscribe(onNext: { [weak self] in
self?.viewModel.switchCamera()
}).disposed(by: self.disposeBag)
......@@ -251,9 +242,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
.subscribe(onNext: { [weak self] rotate in
self?.shouldRotateScreen = rotate
}).disposed(by: self.disposeBag)
// disable switch camera button for audio only calls
self.switchCameraButton.isEnabled = !(self.viewModel.isAudioOnly)
}
// swiftlint:disable function_body_length
......@@ -293,7 +281,7 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [weak self] _ in
if self?.durationLabel.text != "" {
if (self?.viewModel.isAudioOnly ?? true) {
if self?.viewModel.isAudioOnly ?? true {
self?.buttonContainerHeightConstraint.constant = 200
self?.buttonsContainer.containerHeightConstraint.constant = 200
self?.buttonsContainer.stackViewYConstraint.constant = 110
......@@ -389,7 +377,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
.observeOn(MainScheduler.instance)
.subscribe(onNext: { [unowned self] show in
if show {
self.task?.cancel()
self.showCallOptions()
}
}).disposed(by: self.disposeBag)
......@@ -450,7 +437,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
.subscribe(onNext: { [weak self] dontShow in
if dontShow && (!(self?.isCallStarted ?? false)) {
self?.isCallStarted = true
self?.hideCancelButton()
let device = UIDevice.modelName
//Reduce the cancel button for small iPhone
switch device {
......@@ -458,7 +444,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
self?.buttonsContainer.cancelButtonWidthConstraint.constant = 50
self?.buttonsContainer.cancelButtonHeightConstraint.constant = 50
self?.buttonsContainer.cancelButton.cornerRadius = 25
self?.buttonsContainer.cancelButtonBottomConstraint.constant = 30
default : break
}
UIView.animate(withDuration: 0.4, animations: {
......@@ -472,9 +457,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
func removeFromScreen() {
if !self.infoContainer.isHidden {
task?.cancel()
}
UIDevice.current.isProximityMonitoringEnabled = false
UIApplication.shared.isIdleTimerDisabled = false
self.dismiss(animated: false)
......@@ -587,22 +569,17 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}
func showContactInfo() {
if !self.infoContainer.isHidden {
task?.cancel()
if !self.buttonsContainer.isHidden {
self.hideContactInfo()
return
}
self.isMenuShowed = true
self.buttonsContainer.isHidden = false
if !self.capturedVideo.isHidden {
self.switchCameraButton.isHidden = false
}
self.infoContainer.isHidden = false
self.view.layoutIfNeeded()
UIView.animate(withDuration: 0.2, animations: { [weak self] in
self?.capturedVideoBlurEffect.alpha = 0
self?.resizeCapturedVideo(withInfoContainer: true)
self?.infoContainerTopConstraint.constant = -10
if UIDevice.current.hasNotch && (self?.orientation == .landscapeRight || self?.orientation == .landscapeLeft) {
......@@ -612,18 +589,13 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
} else {
self?.buttonsContainerBottomConstraint.constant = 10
}
self?.capturedVideoBlurEffect.alpha = 0.7
self?.view.layoutIfNeeded()
})
task = DispatchWorkItem {[weak self] in self?.hideContactInfo() }
DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + 7, execute: task!)
}
func hideContactInfo() {
self.isMenuShowed = false
UIView.animate(withDuration: 0.2, animations: { [unowned self] in
self.capturedVideoBlurEffect.alpha = self.isVideoHidden ? 1 : 0
self.resizeCapturedVideo(withInfoContainer: false)
self.infoContainerTopConstraint.constant = 150
self.buttonsContainerBottomConstraint.constant = -150
......@@ -631,7 +603,6 @@ class CallViewController: UIViewController, StoryboardBased, ViewModelBased {
}, completion: { [weak self] _ in
self?.infoContainer.isHidden = true
self?.buttonsContainer.isHidden = true
self?.switchCameraButton.isHidden = true
})
}
......
......@@ -176,13 +176,7 @@ class CallViewModel: Stateable, ViewModel {
}()
lazy var showCallOptions: Observable<Bool> = { [unowned self] in
return Observable.combineLatest(self.screenTapped.asObservable(),
isActiveVideoCall) { (tapped, shouldRespond) in
if tapped && shouldRespond {
return true
}
return false
}
return self.screenTapped.asObservable()
}()
lazy var showCancelOption: Observable<Bool> = { [unowned self] in
......
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