From 1f435c46084be7ba295dabb09196ca4edf7a9102 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Mon, 10 May 2021 15:00:13 +0400 Subject: [PATCH] Video Chat Improvements --- .../Sources/VoiceChatActionButton.swift | 4 +- .../VoiceChatCameraPreviewController.swift | 10 ++++- .../Sources/VoiceChatController.swift | 37 ++++++++++++------ .../Contents.json | 2 +- .../{ic_cam_flip.pdf => ic_flip (1).pdf} | Bin 4396 -> 4384 bytes 5 files changed, 38 insertions(+), 15 deletions(-) rename submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/{ic_cam_flip.pdf => ic_flip (1).pdf} (70%) diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift index 355faf490f..26250f9077 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatActionButton.swift @@ -169,7 +169,7 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode { let transition: ContainedViewLayoutTransition = .animated(duration: 0.25, curve: .spring) if small { transition.updateTransformScale(node: strongSelf.backgroundNode, scale: smallScale * 0.9) - transition.updateTransformScale(node: strongSelf.backgroundNode, scale: smallIconScale * 0.9) + transition.updateTransformScale(node: strongSelf.iconNode, scale: smallIconScale * 0.9) } else { transition.updateTransformScale(node: strongSelf.iconNode, scale: snap ? 0.5 : 0.9) } @@ -182,7 +182,7 @@ final class VoiceChatActionButton: HighlightTrackingButtonNode { let transition: ContainedViewLayoutTransition = .animated(duration: 0.25, curve: .spring) if small { transition.updateTransformScale(node: strongSelf.backgroundNode, scale: smallScale) - transition.updateTransformScale(node: strongSelf.backgroundNode, scale: smallIconScale) + transition.updateTransformScale(node: strongSelf.iconNode, scale: smallIconScale) } else { transition.updateTransformScale(node: strongSelf.iconNode, scale: snap ? 0.5 : 1.0) } diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatCameraPreviewController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatCameraPreviewController.swift index 9a4c6d3923..05c2d9dd35 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatCameraPreviewController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatCameraPreviewController.swift @@ -68,7 +68,7 @@ final class VoiceChatCameraPreviewController: ViewController { } self.controllerNode.switchCamera = { [weak self] in self?.switchCamera() - self?.cameraNode.flip(withBackground: true) + self?.cameraNode.flip(withBackground: false) } self.controllerNode.dismiss = { [weak self] in self?.presentingViewController?.dismiss(animated: false, completion: nil) @@ -192,6 +192,7 @@ private class VoiceChatCameraPreviewControllerNode: ViewControllerTracingNode, U self.cancelButton.title = self.presentationData.strings.Common_Cancel self.previewContainerNode = ASDisplayNode() + self.previewContainerNode.clipsToBounds = true self.previewContainerNode.cornerRadius = 11.0 self.previewContainerNode.backgroundColor = .black @@ -264,6 +265,13 @@ private class VoiceChatCameraPreviewControllerNode: ViewControllerTracingNode, U @objc private func switchCameraPressed() { self.switchCamera?() + + let springDuration: Double = 0.7 + let springDamping: CGFloat = 100.0 + self.switchCameraButton.isUserInteractionEnabled = false + self.switchCameraIconNode.layer.animateSpring(from: 0.0 as NSNumber, to: CGFloat.pi as NSNumber, keyPath: "transform.rotation.z", duration: springDuration, damping: springDamping, completion: { [weak self] _ in + self?.switchCameraButton.isUserInteractionEnabled = true + }) } func updatePresentationData(_ presentationData: PresentationData) { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index 678951d7e0..d09c1794e1 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -134,8 +134,8 @@ final class GroupVideoNode: ASDisplayNode { if self.effectView == nil { let effectView = UIVisualEffectView() self.effectView = effectView - effectView.frame = self.videoViewContainer.bounds - self.videoViewContainer.addSubview(effectView) + effectView.frame = self.bounds + self.view.addSubview(effectView) } if animated { UIView.animate(withDuration: 0.3, animations: { @@ -239,7 +239,7 @@ final class GroupVideoNode: ASDisplayNode { transition.updateTransformRotation(view: self.videoView.view, angle: angle) if let effectView = self.effectView { - transition.updateFrame(view: effectView, frame: self.videoViewContainer.bounds) + transition.updateFrame(view: effectView, frame: self.bounds) } // TODO: properly fix the issue @@ -810,14 +810,18 @@ public final class VoiceChatController: ViewController { } } let yourText: String - if (peerEntry.about?.isEmpty ?? true) && peer.smallProfileImage == nil { - yourText = presentationData.strings.VoiceChat_TapToAddPhotoOrBio - } else if peer.smallProfileImage == nil { - yourText = presentationData.strings.VoiceChat_TapToAddPhoto - } else if (peerEntry.about?.isEmpty ?? true) { - yourText = presentationData.strings.VoiceChat_TapToAddBio - } else { + if transparent { yourText = presentationData.strings.VoiceChat_You + } else { + if (peerEntry.about?.isEmpty ?? true) && peer.smallProfileImage == nil { + yourText = presentationData.strings.VoiceChat_TapToAddPhotoOrBio + } else if peer.smallProfileImage == nil { + yourText = presentationData.strings.VoiceChat_TapToAddPhoto + } else if (peerEntry.about?.isEmpty ?? true) { + yourText = presentationData.strings.VoiceChat_TapToAddBio + } else { + yourText = presentationData.strings.VoiceChat_You + } } switch state { case .listening: @@ -3445,6 +3449,13 @@ public final class VoiceChatController: ViewController { @objc private func switchCameraPressed() { self.call.switchVideoCamera() + + let springDuration: Double = 0.7 + let springDamping: CGFloat = 100.0 + self.switchCameraButton.isUserInteractionEnabled = false + self.switchCameraButton.layer.animateSpring(from: 0.0 as NSNumber, to: CGFloat.pi as NSNumber, keyPath: "transform.rotation.z", duration: springDuration, damping: springDamping, completion: { [weak self] _ in + self?.switchCameraButton.isUserInteractionEnabled = true + }) } private var isLandscape: Bool { @@ -3954,6 +3965,10 @@ public final class VoiceChatController: ViewController { } else { effectiveDisplayMode = .fullscreen(controlsHidden: false) } + } else if case .default = effectiveDisplayMode { + if self.hasMainVideo { + self.tileListNode.isHidden = true + } } if previousIsLandscape != isLandscape { @@ -4890,7 +4905,7 @@ public final class VoiceChatController: ViewController { if let (layout, _) = self.validLayout, layout.size.width > layout.size.height, case .compact = layout.metrics.widthClass { return false } - if case .fullscreen = self.displayMode { + if self.isLandscape { return false } diff --git a/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/Contents.json index e6f1b93d3e..5c38ab0966 100644 --- a/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/Contents.json @@ -1,7 +1,7 @@ { "images" : [ { - "filename" : "ic_cam_flip.pdf", + "filename" : "ic_flip (1).pdf", "idiom" : "universal" } ], diff --git a/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/ic_cam_flip.pdf b/submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/ic_flip (1).pdf similarity index 70% rename from submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/ic_cam_flip.pdf rename to submodules/TelegramUI/Images.xcassets/Call/CallSwitchCameraButton.imageset/ic_flip (1).pdf index 5084218a29d6c8d90eb3ae95130f63e3a9729eae..da091564121556c72d61328805625ff74e5b21a0 100644 GIT binary patch delta 1092 zcmZ3Zv_NTseZ85bf}I^#aY<2XVlGz&V`_+Jo{S;Sp6}XUm|Crm7RNmZmNW2pz);q3 z;$U@2ckgdeUX5;KxU76Xxzb{KKbc#pB3xd2Xrq6_o5YPK~o<$&A_Dc0|SS zY3*L`J$(I%C$>F#VUi&zk}1-mVbJ{8Kt@HNISwfviocyrLW1sZr54RaG>R!22(__yYbDn`Co3{e7c8M z$U)wB>yzLGt}_ih7CN?D%)RWiq(LVv_IKD?f!7vEOYS~<&|vaAR?SSKd}jTN1Fr?v zT&^>VE>E2KLVB4>fIiG znT(h3#oRyNXd?0R(vx#Pua&V!-;ma*+rNi>fzI|>>7^aJYYM*>Jll0gc(Z|TwU1uD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