Various improvements

This commit is contained in:
Ilya Laktyushin 2023-01-13 22:39:41 +04:00
parent 930e237bf1
commit a37c84aa68
4 changed files with 12 additions and 14 deletions

View File

@ -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 }

View File

@ -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)

View File

@ -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 {

View File

@ -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 {