From a37c84aa6873afe28a99623caf9acb1297f3e7c1 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Fri, 13 Jan 2023 22:39:41 +0400 Subject: [PATCH] Various improvements --- .../AccountContext/Sources/ChatController.swift | 2 ++ .../Source/Navigation/NavigationController.swift | 14 +------------- submodules/TelegramUI/Sources/ChatController.swift | 6 ++++++ .../TelegramUI/Sources/ChatControllerNode.swift | 4 +++- 4 files changed, 12 insertions(+), 14 deletions(-) diff --git a/submodules/AccountContext/Sources/ChatController.swift b/submodules/AccountContext/Sources/ChatController.swift index ee5a07797a..c028378185 100644 --- a/submodules/AccountContext/Sources/ChatController.swift +++ b/submodules/AccountContext/Sources/ChatController.swift @@ -608,6 +608,8 @@ public protocol ChatController: ViewController { func beginMessageSearch(_ query: String) func displayPromoAnnouncement(text: String) + func updateIsPushed(_ isPushed: Bool) + func hintPlayNextOutgoingGift() var isSendButtonVisible: Bool { get } diff --git a/submodules/Display/Source/Navigation/NavigationController.swift b/submodules/Display/Source/Navigation/NavigationController.swift index bb5da5be73..f73b13db5d 100644 --- a/submodules/Display/Source/Navigation/NavigationController.swift +++ b/submodules/Display/Source/Navigation/NavigationController.swift @@ -1308,19 +1308,7 @@ open class NavigationController: UINavigationController, ContainableController, self.pushViewController(controller, animated: animated) completion() } - - public func updateContainerPulled(_ pushed: Bool) { - guard self.modalContainers.isEmpty else { - return - } - if let rootContainer = self.rootContainer, case let .flat(container) = rootContainer { - let scale: CGFloat = pushed ? 1.06 : 1.0 - - container.view.layer.transform = CATransform3DMakeScale(scale, scale, 1.0) - container.view.layer.animateScale(from: pushed ? 1.0 : 1.06, to: scale, duration: 0.3, timingFunction: kCAMediaTimingFunctionSpring) - } - } - + open override func pushViewController(_ viewController: UIViewController, animated: Bool) { var controllers = self.viewControllers controllers.append(viewController) diff --git a/submodules/TelegramUI/Sources/ChatController.swift b/submodules/TelegramUI/Sources/ChatController.swift index 999612f0df..622727ab96 100644 --- a/submodules/TelegramUI/Sources/ChatController.swift +++ b/submodules/TelegramUI/Sources/ChatController.swift @@ -17576,6 +17576,12 @@ public final class ChatControllerImpl: TelegramBaseController, ChatController, G self.chatDisplayNode.historyNodeContainer.layer.addShakeAnimation(amplitude: -6.0, decay: true) } + + public func updateIsPushed(_ isPushed: Bool) { + let scale: CGFloat = isPushed ? 0.94 : 1.0 + let transition = ContainedViewLayoutTransition.animated(duration: 0.45, curve: .customSpring(damping: 180.0, initialVelocity: 0.0)) + transition.updateTransformScale(node: self.chatDisplayNode.historyNodeContainer, scale: scale) + } } private final class ContextControllerContentSourceImpl: ContextControllerContentSource { diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index 9be0656d2c..cb6c037705 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -1432,7 +1432,9 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate { transition.updateFrame(node: self.backgroundNode, frame: contentBounds) self.backgroundNode.updateLayout(size: contentBounds.size, transition: transition) - transition.updateFrame(node: self.historyNodeContainer, frame: contentBounds) + transition.updateBounds(node: self.historyNodeContainer, bounds: contentBounds) + transition.updatePosition(node: self.historyNodeContainer, position: contentBounds.center) + transition.updateBounds(node: self.historyNode, bounds: CGRect(origin: CGPoint(), size: contentBounds.size)) transition.updatePosition(node: self.historyNode, position: CGPoint(x: contentBounds.size.width / 2.0, y: contentBounds.size.height / 2.0)) if let blurredHistoryNode = self.blurredHistoryNode {