From 0172b53721b44a93c753060d4f7f1a069ab331ed Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Tue, 27 Jul 2021 23:47:53 +0300 Subject: [PATCH] Various Fixes --- submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m | 2 +- .../TelegramCallsUI/Sources/PresentationGroupCall.swift | 3 ++- .../TelegramCallsUI/Sources/VoiceChatController.swift | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m b/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m index 3da20cad91..928c39af20 100644 --- a/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m +++ b/submodules/LegacyComponents/Sources/TGCameraMainPhoneView.m @@ -114,7 +114,7 @@ if (widescreenWidth == 926.0f) { _topPanelOffset = 34.0f; - _topPanelHeight = 77.0f; + _topPanelHeight = 48.0f; _bottomPanelOffset = 94.0f; _bottomPanelHeight = 140.0f; _modeControlOffset = -2.0f; diff --git a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift index 32105eec46..517546ee1a 100644 --- a/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift +++ b/submodules/TelegramCallsUI/Sources/PresentationGroupCall.swift @@ -2596,8 +2596,9 @@ public final class PresentationGroupCallImpl: PresentationGroupCall { } } - func requestVideo(capturer: OngoingCallVideoCapturer) { + func requestVideo(capturer: OngoingCallVideoCapturer, useFrontCamera: Bool = true) { self.videoCapturer = capturer + self.useFrontCamera = useFrontCamera self.hasVideo = true if let videoCapturer = self.videoCapturer { diff --git a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift index 14d605dae7..df7235bb95 100644 --- a/submodules/TelegramCallsUI/Sources/VoiceChatController.swift +++ b/submodules/TelegramCallsUI/Sources/VoiceChatController.swift @@ -3501,6 +3501,7 @@ public final class VoiceChatController: ViewController { guard let strongSelf = self, ready else { return } + var isFrontCamera = true let videoCapturer = OngoingCallVideoCapturer() let input = videoCapturer.video() if let videoView = strongSelf.videoRenderingContext.makeView(input: input, blur: false) { @@ -3510,7 +3511,7 @@ public final class VoiceChatController: ViewController { let controller = VoiceChatCameraPreviewController(sharedContext: strongSelf.context.sharedContext, cameraNode: cameraNode, shareCamera: { [weak self] _, unmuted in if let strongSelf = self { strongSelf.call.setIsMuted(action: unmuted ? .unmuted : .muted(isPushToTalkActive: false)) - (strongSelf.call as! PresentationGroupCallImpl).requestVideo(capturer: videoCapturer) + (strongSelf.call as! PresentationGroupCallImpl).requestVideo(capturer: videoCapturer, useFrontCamera: isFrontCamera) if let (layout, navigationHeight) = strongSelf.validLayout { strongSelf.animatingButtonsSwap = true @@ -3519,7 +3520,8 @@ public final class VoiceChatController: ViewController { } }, switchCamera: { [weak self] in Queue.mainQueue().after(0.1) { - self?.call.switchVideoCamera() + isFrontCamera = !isFrontCamera + videoCapturer.switchVideoInput(isFront: isFrontCamera) } }) strongSelf.controller?.present(controller, in: .window(.root))