Various improvements

This commit is contained in:
Isaac 2025-09-27 01:01:29 +08:00
parent 75722ecbde
commit ecfe436a24
5 changed files with 42 additions and 86 deletions

View File

@ -454,6 +454,7 @@ final class ChatListContainerItemNode: ASDisplayNode {
let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - edgeEffectHeight), size: CGSize(width: size.width, height: edgeEffectHeight)) let edgeEffectFrame = CGRect(origin: CGPoint(x: 0.0, y: size.height - edgeEffectHeight), size: CGSize(width: size.width, height: edgeEffectHeight))
transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame) transition.updateFrame(view: self.edgeEffectView, frame: edgeEffectFrame)
self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: edgeEffectFrame.height, transition: ComponentTransition(transition)) self.edgeEffectView.update(content: self.presentationData.theme.list.plainBackgroundColor, rect: edgeEffectFrame, edge: .bottom, edgeSize: edgeEffectFrame.height, transition: ComponentTransition(transition))
transition.updateAlpha(layer: self.edgeEffectView.layer, alpha: edgeEffectHeight > 21.0 ? 1.0 : 0.0)
} }
func updateScrollingOffset(navigationHeight: CGFloat, offset: CGFloat, transition: ContainedViewLayoutTransition) { func updateScrollingOffset(navigationHeight: CGFloat, offset: CGFloat, transition: ContainedViewLayoutTransition) {

View File

@ -502,7 +502,7 @@ public class ChatTextInputPanelNode: ChatInputPanelNode, ASEditableTextNodeDeleg
self.textInputNodeClippingContainer.clipsToBounds = true self.textInputNodeClippingContainer.clipsToBounds = true
self.textInputSeparator = GlassBackgroundView.ContentColorView() self.textInputSeparator = GlassBackgroundView.ContentColorView()
self.textInputContainerBackgroundView.contentView.addSubview(self.textInputSeparator) //self.textInputContainerBackgroundView.contentView.addSubview(self.textInputSeparator)
self.textInputBackgroundNode = ASImageNode() self.textInputBackgroundNode = ASImageNode()
self.textInputBackgroundNode.displaysAsynchronously = false self.textInputBackgroundNode.displaysAsynchronously = false

View File

@ -239,9 +239,6 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
private var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode? private var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode?
private var inputPanelBackgroundBlurMask: UIImageView?
private var inputPanelBackgroundBlurView: VariableBlurView?
private(set) var inputPanelNode: ChatInputPanelNode? private(set) var inputPanelNode: ChatInputPanelNode?
private weak var currentDismissedInputPanelNode: ChatInputPanelNode? private weak var currentDismissedInputPanelNode: ChatInputPanelNode?
private(set) var secondaryInputPanelNode: ChatInputPanelNode? private(set) var secondaryInputPanelNode: ChatInputPanelNode?
@ -2144,11 +2141,15 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
var inputPanelHideOffset: CGFloat = 0.0 var inputPanelHideOffset: CGFloat = 0.0
if let inputNode = self.inputNode, inputNode.hideInput { if let inputNode = self.inputNode, inputNode.hideInput {
var additionalOffset: CGFloat = 0.0
if case let .media(_, expanded, _) = self.chatPresentationInterfaceState.inputMode, expanded != nil {
additionalOffset = 80.0
}
if let inputPanelSize = inputPanelSize { if let inputPanelSize = inputPanelSize {
inputPanelHideOffset += -inputPanelSize.height - 80.0 inputPanelHideOffset += -inputPanelSize.height - additionalOffset
} }
if let accessoryPanelSize = accessoryPanelSize { if let accessoryPanelSize = accessoryPanelSize {
inputPanelHideOffset += -accessoryPanelSize.height - 80.0 inputPanelHideOffset += -accessoryPanelSize.height - additionalOffset
} }
} }
@ -2203,7 +2204,6 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
} }
} }
if "".isEmpty {
var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode? var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode?
if let current = self.bottomBackgroundEdgeEffectNode { if let current = self.bottomBackgroundEdgeEffectNode {
bottomBackgroundEdgeEffectNode = current bottomBackgroundEdgeEffectNode = current
@ -2214,11 +2214,10 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
self.historyNodeContainer.view.superview?.insertSubview(value.view, aboveSubview: self.historyNodeContainer.view) self.historyNodeContainer.view.superview?.insertSubview(value.view, aboveSubview: self.historyNodeContainer.view)
} }
} }
if let bottomBackgroundEdgeEffectNode { if let bottomBackgroundEdgeEffectNode {
var blurFrame = inputBackgroundFrame var blurFrame = inputBackgroundFrame
blurFrame.origin.y -= 26.0 blurFrame.origin.y -= 26.0
blurFrame.size.height += 100.0 blurFrame.size.height = max(100.0, layout.size.height - blurFrame.origin.y)
transition.updateFrame(node: bottomBackgroundEdgeEffectNode, frame: blurFrame) transition.updateFrame(node: bottomBackgroundEdgeEffectNode, frame: blurFrame)
bottomBackgroundEdgeEffectNode.update( bottomBackgroundEdgeEffectNode.update(
rect: blurFrame, rect: blurFrame,
@ -2227,59 +2226,6 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
transition: transition transition: transition
) )
} }
}
if !"".isEmpty {
let blurView: VariableBlurView
let blurMask: UIImageView
if let current = self.inputPanelBackgroundBlurMask {
blurMask = current
} else {
blurMask = UIImageView()
self.inputPanelBackgroundBlurMask = blurMask
blurMask.image = generateGradientImage(size: CGSize(width: 8.0, height: 16.0), colors: [UIColor(white: 1.0, alpha: 0.0), UIColor(white: 1.0, alpha: 0.0), UIColor(white: 1.0, alpha: 1.0)], locations: [0.0, 0.5, 1.0])?.stretchableImage(withLeftCapWidth: 0, topCapHeight: 16)
}
if let current = self.inputPanelBackgroundBlurView {
blurView = current
} else {
let baseGradientAlpha: CGFloat = 0.5
let numSteps = 8
let firstStep = 1
let firstLocation = 0.5
let colors = (0 ..< numSteps).map { i -> UIColor in
if i < firstStep {
return UIColor(white: 1.0, alpha: 1.0)
} else {
let step: CGFloat = CGFloat(i - firstStep) / CGFloat(numSteps - firstStep - 1)
let value: CGFloat = 1.0 - bezierPoint(0.42, 0.0, 0.58, 1.0, step)
return UIColor(white: 1.0, alpha: baseGradientAlpha * value)
}
}
let locations = (0 ..< numSteps).map { i -> CGFloat in
if i < firstStep {
return 0.0
} else {
let step: CGFloat = CGFloat(i - firstStep) / CGFloat(numSteps - firstStep - 1)
return (firstLocation + (1.0 - firstLocation) * step)
}
}
let backgroundBlurImage = generateGradientImage(size: CGSize(width: 8.0, height: 100.0), colors: colors.reversed(), locations: locations.reversed().map { 1.0 - $0 })!
blurView = VariableBlurView(gradientMask: backgroundBlurImage, maxBlurRadius: 15.0)
self.inputPanelBackgroundBlurView = blurView
self.historyNodeContainer.view.superview?.insertSubview(blurView, aboveSubview: self.historyNodeContainer.view)
blurView.mask = blurMask
}
var blurFrame = inputBackgroundFrame
blurFrame.origin.y -= 18.0
blurFrame.size.height += 100.0
transition.updateFrame(view: blurView, frame: blurFrame)
transition.updateFrame(view: blurMask, frame: CGRect(origin: CGPoint(), size: blurFrame.size))
}
let additionalScrollDistance: CGFloat = 0.0 let additionalScrollDistance: CGFloat = 0.0
var scrollToTop = false var scrollToTop = false
@ -3400,6 +3346,8 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
inlineSearchResultsView.layer.allowsGroupOpacity = true inlineSearchResultsView.layer.allowsGroupOpacity = true
if let emptyNode = self.emptyNode { if let emptyNode = self.emptyNode {
self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: emptyNode.view) self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: emptyNode.view)
} else if let bottomBackgroundEdgeEffectNode = self.bottomBackgroundEdgeEffectNode {
self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: bottomBackgroundEdgeEffectNode.view)
} else { } else {
self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: self.historyNodeContainer.view) self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: self.historyNodeContainer.view)
} }

View File

@ -332,7 +332,7 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode {
buttonView.alpha = 0.0 buttonView.alpha = 0.0
self.view.addSubview(buttonView) self.view.addSubview(buttonView)
} }
let listModeFrame = CGRect(origin: CGPoint(x: size.width - params.rightInset - 20.0 - 8.0 - buttonSize.width, y: floor((size.height - buttonSize.height) * 0.5)), size: buttonSize) let listModeFrame = CGRect(origin: CGPoint(x: params.width - params.rightInset - 20.0 - 8.0 - buttonSize.width, y: floor((size.height - buttonSize.height) * 0.5)), size: buttonSize)
listModeButtonFrameValue = listModeFrame listModeButtonFrameValue = listModeFrame
listModeButtonTransition.setPosition(view: buttonView, position: CGPoint(x: listModeFrame.minX + listModeFrame.width * buttonView.layer.anchorPoint.x, y: listModeFrame.minY + listModeFrame.height * buttonView.layer.anchorPoint.y)) listModeButtonTransition.setPosition(view: buttonView, position: CGPoint(x: listModeFrame.minX + listModeFrame.width * buttonView.layer.anchorPoint.x, y: listModeFrame.minY + listModeFrame.height * buttonView.layer.anchorPoint.y))
listModeButtonTransition.setBounds(view: buttonView, bounds: CGRect(origin: CGPoint(), size: listModeFrame.size)) listModeButtonTransition.setBounds(view: buttonView, bounds: CGRect(origin: CGPoint(), size: listModeFrame.size))
@ -499,7 +499,10 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode {
environment: {}, environment: {},
containerSize: CGSize(width: 200.0, height: 100.0) containerSize: CGSize(width: 200.0, height: 100.0)
) )
let resultsTextFrame = CGRect(origin: CGPoint(x: nextLeftX - 3.0, y: floor((size.height - resultsTextSize.height) * 0.5)), size: resultsTextSize) var resultsTextFrame = CGRect(origin: CGPoint(x: nextLeftX - 3.0, y: floor((size.height - resultsTextSize.height) * 0.5)), size: resultsTextSize)
if !displaySearchMembers && !(!self.alwaysShowTotalMessagesCount && self.externalSearchResultsCount == nil) {
resultsTextFrame.origin.x += 8.0
}
resultsTextFrameValue = resultsTextFrame resultsTextFrameValue = resultsTextFrame
if let resultsTextView = resultsText.view { if let resultsTextView = resultsText.view {
if resultsTextView.superview == nil { if resultsTextView.superview == nil {

View File

@ -118,18 +118,22 @@ final class HashtagChatInputContextPanelNode: ChatInputContextPanelNode {
guard let self else { guard let self else {
return return
} }
var topOffset: CGFloat = 0.0 var topOffset: CGFloat?
switch offset { switch offset {
case let .known(offset): case let .known(offset):
topOffset = max(0.0, -offset + self.listView.insets.top) topOffset = max(0.0, -offset + self.listView.insets.top)
case .unknown: case .unknown:
break topOffset = 0.0
case .none: case .none:
break break
} }
if let topOffset {
self.backgroundView.isHidden = false self.backgroundView.isHidden = false
self.backgroundView.layer.position = CGPoint(x: 0.0, y: topOffset) self.backgroundView.layer.position = CGPoint(x: 0.0, y: topOffset)
} else {
self.backgroundView.isHidden = true
}
} }
} }
@ -269,7 +273,7 @@ final class HashtagChatInputContextPanelNode: ChatInputContextPanelNode {
self.enqueuedTransitions.remove(at: 0) self.enqueuedTransitions.remove(at: 0)
var options = ListViewDeleteAndInsertOptions() var options = ListViewDeleteAndInsertOptions()
if firstTime { if firstTime || "".isEmpty {
//options.insert(.Synchronous) //options.insert(.Synchronous)
//options.insert(.LowLatency) //options.insert(.LowLatency)
} else { } else {