From 4fc3ba70fc501ec44e3e3197a745f8d226d4bc3d Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Sun, 7 Sep 2025 14:57:43 +0500 Subject: [PATCH] Various fixes --- .../Sources/Components/MediaStreamComponent.swift | 15 +++++++-------- .../Components/MediaStreamVideoComponent.swift | 4 +++- .../Sources/MinimizedContainer.swift | 2 +- 3 files changed, 11 insertions(+), 10 deletions(-) diff --git a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift index b292d0058b..8691273307 100644 --- a/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift +++ b/submodules/TelegramCallsUI/Sources/Components/MediaStreamComponent.swift @@ -257,7 +257,7 @@ public final class MediaStreamComponent: CombinedComponent { let local = Local() return { context in - _body(context, local) // { context in + _body(context, local) } } @@ -1052,10 +1052,10 @@ public final class MediaStreamComponentController: ViewControllerComponentContai view.expandFromPictureInPicture() } - self.view.clipsToBounds = true - - self.view.layer.animatePosition(from: CGPoint(x: self.view.frame.center.x, y: self.view.bounds.maxY + self.view.bounds.height / 2), to: self.view.center, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, completion: { _ in - }) + self.view.clipsToBounds = true + + self.view.layer.animatePosition(from: CGPoint(x: self.view.frame.center.x, y: self.view.bounds.maxY + self.view.bounds.height / 2), to: self.view.center, duration: 0.5, timingFunction: kCAMediaTimingFunctionSpring, completion: { _ in + }) self.view.layer.allowsGroupOpacity = true @@ -1081,8 +1081,7 @@ public final class MediaStreamComponentController: ViewControllerComponentContai override public func viewDidLoad() { super.viewDidLoad() - // TODO: replace with actual color - backgroundDimView.backgroundColor = .black.withAlphaComponent(0.3) + self.backgroundDimView.backgroundColor = .black.withAlphaComponent(0.3) self.view.clipsToBounds = false } @@ -1094,7 +1093,7 @@ public final class MediaStreamComponentController: ViewControllerComponentContai override public func viewDidLayoutSubviews() { super.viewDidLayoutSubviews() let dimViewSide: CGFloat = max(view.bounds.width, view.bounds.height) - backgroundDimView.frame = .init(x: view.bounds.midX - dimViewSide / 2, y: -view.bounds.height * 3, width: dimViewSide, height: view.bounds.height * 4) + self.backgroundDimView.frame = .init(x: view.bounds.midX - dimViewSide / 2, y: -view.bounds.height * 3, width: dimViewSide, height: view.bounds.height * 4) } public func dismiss(closing: Bool, manual: Bool) { diff --git a/submodules/TelegramCallsUI/Sources/Components/MediaStreamVideoComponent.swift b/submodules/TelegramCallsUI/Sources/Components/MediaStreamVideoComponent.swift index f7d28ce101..f029ed407e 100644 --- a/submodules/TelegramCallsUI/Sources/Components/MediaStreamVideoComponent.swift +++ b/submodules/TelegramCallsUI/Sources/Components/MediaStreamVideoComponent.swift @@ -580,7 +580,9 @@ final class MediaStreamVideoComponent: Component { videoView.isHidden = true } } else { - videoSize = CGSize(width: 16 / 9 * 100.0, height: 100.0).aspectFitted(.init(width: availableSize.width - videoInset * 2, height: availableSize.height)) + let availableVideoWidth = min(availableSize.width, availableSize.height) - videoInset * 2 + let availableVideoHeight = availableVideoWidth * 9.0 / 16 + videoSize = CGSize(width: 16 / 9 * 100.0, height: 100.0).aspectFitted(.init(width: availableVideoWidth, height: availableVideoHeight)) } let loadingBlurViewFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - videoSize.width) / 2.0), y: floor((availableSize.height - videoSize.height) / 2.0)), size: videoSize) diff --git a/submodules/TelegramUI/Components/MinimizedContainer/Sources/MinimizedContainer.swift b/submodules/TelegramUI/Components/MinimizedContainer/Sources/MinimizedContainer.swift index 27629ffebe..723e207e34 100644 --- a/submodules/TelegramUI/Components/MinimizedContainer/Sources/MinimizedContainer.swift +++ b/submodules/TelegramUI/Components/MinimizedContainer/Sources/MinimizedContainer.swift @@ -431,7 +431,7 @@ public class MinimizedContainerImpl: ASDisplayNode, MinimizedContainer, ASScroll if let _ = self.item(at: location.y) { if self.isExpanded { - return abs(velocity.x) > abs(velocity.y) + return abs(velocity.x) > abs(velocity.y) && !self.isApplyingTransition } else { return abs(velocity.y) > abs(velocity.x) }