mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Various improvements
This commit is contained in:
parent
59dc46e0f5
commit
524c29cbe3
28 changed files with 1159 additions and 164 deletions
|
|
@ -498,7 +498,7 @@ open class NavigationController: UINavigationController, ContainableController,
|
|||
}
|
||||
|
||||
if let globalScrollToTopNode = self.globalScrollToTopNode {
|
||||
globalScrollToTopNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: layout.size.width, height: 1.0))
|
||||
globalScrollToTopNode.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: layout.size.width, height: 1))
|
||||
}
|
||||
|
||||
var overlayContainerLayout = layout
|
||||
|
|
|
|||
|
|
@ -87,7 +87,7 @@ final class NavigationSplitContainer: ASDisplayNode {
|
|||
let masterWidth: CGFloat = min(max(320.0, floor(layout.size.width / 3.0)), floor(layout.size.width / 2.0))
|
||||
let detailWidth = layout.size.width - masterWidth
|
||||
|
||||
self.masterScrollToTopView.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: masterWidth, height: 1.0))
|
||||
self.masterScrollToTopView.frame = CGRect(origin: CGPoint(x: 0.0, y: -1.0), size: CGSize(width: masterWidth, height: 10.0))
|
||||
self.detailScrollToTopView.frame = CGRect(origin: CGPoint(x: masterWidth, y: -1.0), size: CGSize(width: detailWidth, height: 1.0))
|
||||
|
||||
transition.updateFrame(node: self.masterContainer, frame: CGRect(origin: CGPoint(), size: CGSize(width: masterWidth, height: layout.size.height)))
|
||||
|
|
|
|||
|
|
@ -8,11 +8,11 @@ class ScrollToTopView: UIScrollView, UIScrollViewDelegate {
|
|||
super.init(frame: frame)
|
||||
|
||||
self.isOpaque = false
|
||||
self.backgroundColor = .clear
|
||||
self.delegate = self
|
||||
self.scrollsToTop = true
|
||||
if #available(iOSApplicationExtension 11.0, iOS 11.0, *) {
|
||||
self.contentInsetAdjustmentBehavior = .never
|
||||
self.contentInsetAdjustmentBehavior = .never
|
||||
if #available(iOS 17.0, *) {
|
||||
self.allowsKeyboardScrolling = false
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -23,8 +23,8 @@ class ScrollToTopView: UIScrollView, UIScrollViewDelegate {
|
|||
override var frame: CGRect {
|
||||
didSet {
|
||||
let frame = self.frame
|
||||
self.contentSize = CGSize(width: frame.width, height: frame.height + 1.0)
|
||||
self.contentOffset = CGPoint(x: 0.0, y: 1.0)
|
||||
self.contentSize = CGSize(width: frame.width, height: frame.height + 1000.0)
|
||||
self.contentOffset = CGPoint(x: 0.0, y: 1000.0)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -35,6 +35,10 @@ class ScrollToTopView: UIScrollView, UIScrollViewDelegate {
|
|||
|
||||
return false
|
||||
}
|
||||
|
||||
func scrollViewDidScrollToTop(_ scrollView: UIScrollView) {
|
||||
print("scrollViewDidScrollToTop")
|
||||
}
|
||||
}
|
||||
|
||||
class ScrollToTopNode: ASDisplayNode {
|
||||
|
|
|
|||
|
|
@ -306,14 +306,7 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
|
|||
return self._ready
|
||||
}
|
||||
|
||||
private var scrollToTopView: ScrollToTopView?
|
||||
public var scrollToTop: (() -> Void)? {
|
||||
didSet {
|
||||
if self.isViewLoaded {
|
||||
self.updateScrollToTopView()
|
||||
}
|
||||
}
|
||||
}
|
||||
public var scrollToTop: (() -> Void)?
|
||||
public var scrollToTopWithTabBar: (() -> Void)?
|
||||
public var longTapWithTabBar: (() -> Void)?
|
||||
|
||||
|
|
@ -357,24 +350,6 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
|
|||
open func didAppearInContextPreview() {
|
||||
}
|
||||
|
||||
private func updateScrollToTopView() {
|
||||
/*if self.scrollToTop != nil {
|
||||
if let displayNode = self._displayNode , self.scrollToTopView == nil {
|
||||
let scrollToTopView = ScrollToTopView(frame: CGRect(x: 0.0, y: -1.0, width: displayNode.bounds.size.width, height: 1.0))
|
||||
scrollToTopView.action = { [weak self] in
|
||||
if let scrollToTop = self?.scrollToTop {
|
||||
scrollToTop()
|
||||
}
|
||||
}
|
||||
self.scrollToTopView = scrollToTopView
|
||||
self.view.addSubview(scrollToTopView)
|
||||
}
|
||||
} else*/ if let scrollToTopView = self.scrollToTopView {
|
||||
scrollToTopView.removeFromSuperview()
|
||||
self.scrollToTopView = nil
|
||||
}
|
||||
}
|
||||
|
||||
public var titleSignal: Signal<String?, NoError> {
|
||||
return Signal { [weak self] subscriber in
|
||||
guard let self else {
|
||||
|
|
@ -514,10 +489,6 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
|
|||
if self.automaticallyControlPresentationContextLayout {
|
||||
self.presentationContext.containerLayoutUpdated(layout, transition: transition)
|
||||
}
|
||||
|
||||
if let scrollToTopView = self.scrollToTopView {
|
||||
scrollToTopView.frame = CGRect(x: 0.0, y: 0.0, width: layout.size.width, height: 10.0)
|
||||
}
|
||||
}
|
||||
|
||||
open func navigationStackConfigurationUpdated(next: [ViewController]) {
|
||||
|
|
@ -541,7 +512,6 @@ public protocol CustomViewControllerNavigationDataSummary: AnyObject {
|
|||
}
|
||||
|
||||
open func displayNodeDidLoad() {
|
||||
self.updateScrollToTopView()
|
||||
if let backgroundColor = self.displayNode.backgroundColor, backgroundColor.alpha.isEqual(to: 1.0) {
|
||||
self.blocksBackgroundWhenInOverlay = true
|
||||
self.isOpaqueWhenInOverlay = true
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue