mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Web app improvements
This commit is contained in:
@@ -8,7 +8,7 @@ public protocol MinimizedContainer: ASDisplayNode {
|
||||
|
||||
var willMaximize: (() -> Void)? { get set }
|
||||
|
||||
func addController(_ viewController: ViewController, transition: ContainedViewLayoutTransition)
|
||||
func addController(_ viewController: ViewController, beforeMaximize: @escaping (NavigationController, @escaping () -> Void) -> Void, transition: ContainedViewLayoutTransition)
|
||||
func maximizeController(_ viewController: ViewController, animated: Bool, completion: @escaping (Bool) -> Void)
|
||||
func collapse()
|
||||
func dismissAll(completion: @escaping () -> Void)
|
||||
|
||||
@@ -842,7 +842,11 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
if case .flat = navigationLayout.root, let minimizedContainer = self.minimizedContainer {
|
||||
if minimizedContainer.supernode !== self.displayNode {
|
||||
if let rootContainer = self.rootContainer, case let .flat(flatContainer) = rootContainer {
|
||||
self.displayNode.insertSubnode(minimizedContainer, aboveSubnode: flatContainer)
|
||||
if let rootModalFrame = self.rootModalFrame {
|
||||
self.displayNode.insertSubnode(minimizedContainer, aboveSubnode: rootModalFrame)
|
||||
} else {
|
||||
self.displayNode.insertSubnode(minimizedContainer, aboveSubnode: flatContainer)
|
||||
}
|
||||
} else {
|
||||
self.displayNode.insertSubnode(minimizedContainer, at: 0)
|
||||
}
|
||||
@@ -1572,7 +1576,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
self._viewControllersPromise.set(self.viewControllers)
|
||||
}
|
||||
|
||||
public func minimizeViewController(_ viewController: ViewController, damping: CGFloat?, velocity: CGFloat? = nil, setupContainer: (MinimizedContainer?) -> MinimizedContainer?, animated: Bool) {
|
||||
public func minimizeViewController(_ viewController: ViewController, damping: CGFloat?, velocity: CGFloat? = nil, beforeMaximize: @escaping (NavigationController, @escaping () -> Void) -> Void, setupContainer: (MinimizedContainer?) -> MinimizedContainer?, animated: Bool) {
|
||||
let transition: ContainedViewLayoutTransition = animated ? .animated(duration: 0.4, curve: .customSpring(damping: damping ?? 124.0, initialVelocity: velocity ?? 0.0)) : .immediate
|
||||
|
||||
let minimizedContainer = setupContainer(self.minimizedContainer)
|
||||
@@ -1592,7 +1596,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
||||
}
|
||||
viewController.isMinimized = true
|
||||
self.filterController(viewController, animated: true)
|
||||
minimizedContainer?.addController(viewController, transition: transition)
|
||||
minimizedContainer?.addController(viewController, beforeMaximize: beforeMaximize, transition: transition)
|
||||
}
|
||||
|
||||
private var isMaximizing = false
|
||||
|
||||
@@ -485,6 +485,9 @@ final class NavigationModalContainer: ASDisplayNode, ASScrollViewDelegate, ASGes
|
||||
let alphaTransition: ContainedViewLayoutTransition = .animated(duration: 0.25, curve: .easeInOut)
|
||||
let positionTransition: ContainedViewLayoutTransition = .animated(duration: 0.25, curve: .easeInOut)
|
||||
alphaTransition.updateAlpha(node: self.dim, alpha: 0.0, beginWithCurrentState: true)
|
||||
if let lastController = self.container.controllers.last, lastController.isMinimized {
|
||||
self.dim.layer.removeAllAnimations()
|
||||
}
|
||||
positionTransition.updatePosition(node: self.container, position: CGPoint(x: self.container.position.x, y: self.bounds.height + self.container.bounds.height / 2.0 + self.bounds.height), beginWithCurrentState: true, completion: { [weak self] _ in
|
||||
guard let strongSelf = self else {
|
||||
return
|
||||
|
||||
Reference in New Issue
Block a user