Temp fixes

This commit is contained in:
Isaac 2025-12-27 16:34:51 +08:00
parent 3f87ee8321
commit 9d6518a738
5 changed files with 18 additions and 7 deletions

View file

@ -217,6 +217,7 @@ public final class ChatListSearchItemHeader: ListViewItemHeader {
public let action: ((ASDisplayNode) -> Void)?
public let height: CGFloat = 28.0
public let isSticky: Bool = false
public init(type: ChatListSearchItemHeaderType, theme: PresentationTheme, strings: PresentationStrings, actionTitle: String? = nil, action: ((ASDisplayNode) -> Void)? = nil) {
self.type = type

View file

@ -3873,7 +3873,11 @@ open class ListView: ASDisplayNode, ASScrollViewDelegate, ASGestureRecognizerDel
switch item.stickDirection {
case .top:
naturalY = lowerBound
headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
if item.isSticky {
headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(max(upperDisplayBound, upperBound), lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
} else {
headerFrame = CGRect(origin: CGPoint(x: 0.0, y: min(upperBound, lowerBound - itemHeaderHeight)), size: CGSize(width: self.visibleSize.width, height: itemHeaderHeight))
}
stickLocationDistance = headerFrame.minY - upperBound
stickLocationDistanceFactor = max(0.0, min(1.0, stickLocationDistance / itemHeaderHeight))
case .topEdge:

View file

@ -12,6 +12,7 @@ public protocol ListViewItemHeader: AnyObject {
var id: ListViewItemNode.HeaderId { get }
var stackingId: ListViewItemNode.HeaderId? { get }
var stickDirection: ListViewItemHeaderStickDirection { get }
var isSticky: Bool { get }
var height: CGFloat { get }
var stickOverInsets: Bool { get }
@ -21,6 +22,12 @@ public protocol ListViewItemHeader: AnyObject {
func updateNode(_ node: ListViewItemHeaderNode, previous: ListViewItemHeader?, next: ListViewItemHeader?)
}
public extension ListViewItemHeader {
var isSticky: Bool {
return true
}
}
open class ListViewItemHeaderNode: ASDisplayNode {
let isRotated: Bool
final private(set) var internalStickLocationDistanceFactor: CGFloat = 0.0

View file

@ -97,7 +97,7 @@ public final class ListSectionHeaderNode: ASDisplayNode {
self.layer.addSublayer(self.backgroundLayer)
self.view.addSubview(self.labelBackgroundView)
//self.view.addSubview(self.labelBackgroundView)
self.addSubnode(self.label)
//self.backgroundLayer.backgroundColor = theme.chatList.sectionHeaderFillColor.cgColor
@ -159,17 +159,16 @@ public final class ListSectionHeaderNode: ASDisplayNode {
self.label.frame = labelFrame
let labelBackgroundSize: CGFloat = labelSize.height
let labelBackgroundInnerInset: CGFloat = 6.0
let labelBackgroundInnerInset: CGFloat = 2.0
let labelBackgroundInset: CGFloat = 10.0 + labelBackgroundInnerInset
if self.labelBackgroundView.image?.size.width != labelBackgroundSize + labelBackgroundInset * 2.0 {
self.labelBackgroundView.image = blurredImage(generateImage(CGSize(width: labelBackgroundSize + labelBackgroundInset * 2.0, height: labelBackgroundSize + labelBackgroundInset * 2.0), rotatedContext: { size, context in
context.clear(CGRect(origin: CGPoint(), size: size))
context.setFillColor(UIColor.white.cgColor)
context.fillEllipse(in: CGRect(origin: CGPoint(x: labelBackgroundInset - labelBackgroundInnerInset, y: labelBackgroundInset - labelBackgroundInnerInset), size: CGSize(width: labelBackgroundSize + labelBackgroundInnerInset * 2.0, height: labelBackgroundSize + labelBackgroundInnerInset * 2.0)))
})!, radius: 19, iterations: 3)?.stretchableImage(withLeftCapWidth: Int(labelBackgroundInset + labelBackgroundSize * 0.5), topCapHeight: Int(labelBackgroundInset + labelBackgroundSize * 0.5)).withRenderingMode(.alwaysTemplate)
})!, radius: 17, iterations: 3)?.stretchableImage(withLeftCapWidth: Int(labelBackgroundInset + labelBackgroundSize * 0.5), topCapHeight: Int(labelBackgroundInset + labelBackgroundSize * 0.5)).withRenderingMode(.alwaysTemplate)
}
self.labelBackgroundView.tintColor = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.85)
//self.labelBackgroundView.tintColor = UIColor.blue.withMultipliedAlpha(0.8)
self.labelBackgroundView.tintColor = self.theme.list.plainBackgroundColor.withAlphaComponent(self.theme.overallDarkAppearance ? 0.5 : 0.7)
self.labelBackgroundView.frame = labelFrame.insetBy(dx: -labelBackgroundInset - 4.0, dy: -labelBackgroundInset)

View file

@ -1435,7 +1435,7 @@ public final class PeerInfoGiftsPaneNode: ASDisplayNode, PeerInfoPaneNode, UIScr
self.currentParams = (size, topInset, sideInset, bottomInset, deviceMetrics, visibleHeight, isScrollingLockedAtTop, expandProgress, navigationHeight, presentationData)
self.presentationDataPromise.set(.single(presentationData))
self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
//self.backgroundNode.backgroundColor = presentationData.theme.list.blocksBackgroundColor
transition.updateFrame(node: self.backgroundNode, frame: CGRect(origin: CGPoint(x: 0.0, y: 48.0), size: size))
transition.updateFrame(node: self.scrollNode, frame: CGRect(origin: CGPoint(), size: size))