UI optimizations

This commit is contained in:
Ali
2023-02-18 00:05:50 +04:00
parent 1acde55d24
commit 8735edc6fb
15 changed files with 263 additions and 68 deletions

View File

@@ -383,8 +383,41 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
private let waitingForNodesDisposable = MetaDisposable()
private var auxiliaryDisplayLink: CADisplayLink?
private var auxiliaryDisplayLinkHandle: SharedDisplayLinkDriver.Link?
private var debugView: UIView?
private var isAuxiliaryDisplayLinkEnabled: Bool = false {
didSet {
if self.isAuxiliaryDisplayLinkEnabled {
if self.auxiliaryDisplayLinkHandle == nil {
self.auxiliaryDisplayLinkHandle = SharedDisplayLinkDriver.shared.add(needsHighestFramerate: true, { [weak self] in
guard let self else {
return
}
if self.debugView == nil {
let debugView = UIView(frame: CGRect(origin: CGPoint(), size: CGSize(width: 1.0, height: 1.0)))
debugView.backgroundColor = .black
debugView.alpha = 0.0001
self.debugView = debugView
self.view.addSubview(debugView)
}
if let debugView = self.debugView {
if debugView.frame.origin.x == 0.0 {
debugView.frame = CGRect(origin: CGPoint(x: 1.0, y: 0.0), size: CGSize(width: 1.0, height: 1.0))
} else {
debugView.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: 1.0, height: 1.0))
}
}
})
}
} else if let auxiliaryDisplayLinkHandle = self.auxiliaryDisplayLinkHandle {
self.auxiliaryDisplayLinkHandle = nil
auxiliaryDisplayLinkHandle.invalidate()
if let debugView = self.debugView {
self.debugView = nil
debugView.removeFromSuperview()
}
}
/*if self.isAuxiliaryDisplayLinkEnabled != oldValue {
if self.isAuxiliaryDisplayLinkEnabled {
if self.auxiliaryDisplayLink == nil {
@@ -3536,7 +3569,7 @@ open class ListView: ASDisplayNode, UIScrollViewAccessibilityDelegate, UIGesture
}
}
private func updateItemHeaders(leftInset: CGFloat, rightInset: CGFloat, synchronousLoad: Bool, transition: (ContainedViewLayoutTransition, Bool, CGFloat) = (.immediate, false, 0.0), animateInsertion: Bool = false) {
private func updateItemHeaders(leftInset: CGFloat, rightInset: CGFloat, synchronousLoad: Bool, transition: (ContainedViewLayoutTransition, Bool, CGFloat) = (.immediate, false, 0.0), animateInsertion: Bool = false) {
self.assignHeaderSpaceAffinities()
let upperDisplayBound = self.headerInsets.top