mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
no message
This commit is contained in:
parent
daa642eacb
commit
a4de6e5fb6
@ -555,9 +555,11 @@ open class ListView: ASDisplayNode, UIScrollViewDelegate, UIGestureRecognizerDel
|
||||
topItemEdge = itemNodes[0].apparentFrame.origin.y
|
||||
}
|
||||
|
||||
var bottomItemNode: ListViewItemNode?
|
||||
for i in (0 ..< self.itemNodes.count).reversed() {
|
||||
if let index = itemNodes[i].index {
|
||||
if index == self.items.count - 1 {
|
||||
bottomItemNode = itemNodes[i]
|
||||
bottomItemFound = true
|
||||
}
|
||||
break
|
||||
@ -622,16 +624,16 @@ open class ListView: ASDisplayNode, UIScrollViewDelegate, UIGestureRecognizerDel
|
||||
}
|
||||
|
||||
if visibleAreaHeight > completeHeight {
|
||||
if let itemNode = self.itemNodes.last, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
if let itemNode = bottomItemNode, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
itemNode.updateTrailingItemSpace(visibleAreaHeight - completeHeight, transition: transition)
|
||||
}
|
||||
} else {
|
||||
if let itemNode = self.itemNodes.last, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
if let itemNode = bottomItemNode, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
itemNode.updateTrailingItemSpace(0.0, transition: transition)
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if let itemNode = self.itemNodes.last, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
if let itemNode = bottomItemNode, itemNode.wantsTrailingItemSpaceUpdates {
|
||||
itemNode.updateTrailingItemSpace(0.0, transition: transition)
|
||||
}
|
||||
if topItemFound {
|
||||
|
@ -4,9 +4,18 @@ import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
|
||||
private class NavigationControllerView: UIView {
|
||||
var inTransition = false
|
||||
|
||||
override class var layerClass: AnyClass {
|
||||
return CATracingLayer.self
|
||||
}
|
||||
|
||||
override func hitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {
|
||||
if self.bounds.contains(point) && self.inTransition {
|
||||
return self
|
||||
}
|
||||
return super.hitTest(point, with: event)
|
||||
}
|
||||
}
|
||||
|
||||
open class NavigationController: NavigationControllerProxy, ContainableController, UIGestureRecognizerDelegate {
|
||||
@ -68,14 +77,6 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
|
||||
let containedLayout = ContainerViewLayout(size: layout.size, intrinsicInsets: layout.intrinsicInsets, statusBarHeight: layout.statusBarHeight, inputHeight: layout.inputHeight)
|
||||
|
||||
/*for controller in self.viewControllers {
|
||||
if let controller = controller as? ContainableController {
|
||||
controller.containerLayoutUpdated(containedLayout, transition: transition)
|
||||
} else {
|
||||
controller.viewWillTransition(to: layout.size, with: SystemContainedControllerTransitionCoordinator())
|
||||
}
|
||||
}*/
|
||||
|
||||
if let topViewController = self.topViewController {
|
||||
if let topViewController = topViewController as? ContainableController {
|
||||
topViewController.containerLayoutUpdated(containedLayout, transition: transition)
|
||||
@ -138,7 +139,9 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
let velocity = recognizer.velocity(in: self.view).x
|
||||
|
||||
if velocity > 1000 || navigationTransitionCoordinator.progress > 0.2 {
|
||||
(self.view as! NavigationControllerView).inTransition = true
|
||||
navigationTransitionCoordinator.animateCompletion(velocity, completion: {
|
||||
(self.view as! NavigationControllerView).inTransition = false
|
||||
self.navigationTransitionCoordinator = nil
|
||||
|
||||
//self._navigationBar.endInteractivePopProgress()
|
||||
@ -167,7 +170,9 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
bottomController.viewWillDisappear(true)
|
||||
}
|
||||
|
||||
(self.view as! NavigationControllerView).inTransition = true
|
||||
navigationTransitionCoordinator.animateCancel({
|
||||
(self.view as! NavigationControllerView).inTransition = false
|
||||
self.navigationTransitionCoordinator = nil
|
||||
|
||||
//self._navigationBar.endInteractivePopProgress()
|
||||
@ -192,7 +197,9 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
bottomController.viewWillDisappear(true)
|
||||
}
|
||||
|
||||
(self.view as! NavigationControllerView).inTransition = true
|
||||
navigationTransitionCoordinator.animateCancel({
|
||||
(self.view as! NavigationControllerView).inTransition = false
|
||||
self.navigationTransitionCoordinator = nil
|
||||
|
||||
if self.viewControllers.count >= 2 && self.navigationTransitionCoordinator == nil {
|
||||
@ -336,8 +343,10 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
let navigationTransitionCoordinator = NavigationTransitionCoordinator(transition: .Pop, container: self.view, topView: topView, topNavigationBar: (topController as? ViewController)?.navigationBar, bottomView: bottomView, bottomNavigationBar: (bottomController as? ViewController)?.navigationBar)
|
||||
self.navigationTransitionCoordinator = navigationTransitionCoordinator
|
||||
|
||||
(self.view as! NavigationControllerView).inTransition = true
|
||||
navigationTransitionCoordinator.animateCompletion(0.0, completion: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
(strongSelf.view as! NavigationControllerView).inTransition = false
|
||||
strongSelf.navigationTransitionCoordinator = nil
|
||||
|
||||
topController.setIgnoreAppearanceMethodInvocations(true)
|
||||
@ -370,8 +379,10 @@ open class NavigationController: NavigationControllerProxy, ContainableControlle
|
||||
|
||||
topView.isUserInteractionEnabled = false
|
||||
|
||||
(self.view as! NavigationControllerView).inTransition = true
|
||||
navigationTransitionCoordinator.animateCompletion(0.0, completion: { [weak self] in
|
||||
if let strongSelf = self {
|
||||
(strongSelf.view as! NavigationControllerView).inTransition = false
|
||||
strongSelf.navigationTransitionCoordinator = nil
|
||||
|
||||
topController.setIgnoreAppearanceMethodInvocations(true)
|
||||
|
@ -1,6 +1,7 @@
|
||||
import Foundation
|
||||
import UIKit
|
||||
import AsyncDisplayKit
|
||||
import SwiftSignalKit
|
||||
|
||||
open class TabBarController: ViewController {
|
||||
private var containerLayout = ContainerViewLayout()
|
||||
@ -41,6 +42,8 @@ open class TabBarController: ViewController {
|
||||
|
||||
var currentController: ViewController?
|
||||
|
||||
private let pendingControllerDisposable = MetaDisposable()
|
||||
|
||||
override public init(navigationBar: NavigationBar = NavigationBar()) {
|
||||
super.init(navigationBar: navigationBar)
|
||||
}
|
||||
@ -49,10 +52,19 @@ open class TabBarController: ViewController {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.pendingControllerDisposable.dispose()
|
||||
}
|
||||
|
||||
override open func loadDisplayNode() {
|
||||
self.displayNode = TabBarControllerNode(itemSelected: { [weak self] index in
|
||||
if let strongSelf = self {
|
||||
strongSelf.selectedIndex = index
|
||||
strongSelf.controllers[index].containerLayoutUpdated(strongSelf.containerLayout.addedInsets(insets: UIEdgeInsets(top: 0.0, left: 0.0, bottom: 49.0, right: 0.0)), transition: .immediate)
|
||||
strongSelf.pendingControllerDisposable.set((strongSelf.controllers[index].ready.get() |> deliverOnMainQueue).start(next: { _ in
|
||||
if let strongSelf = self {
|
||||
strongSelf.selectedIndex = index
|
||||
}
|
||||
}))
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user