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))
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))
transition.updateAlpha(layer: self.edgeEffectView.layer, alpha: edgeEffectHeight > 21.0 ? 1.0 : 0.0)
}
func updateScrollingOffset(navigationHeight: CGFloat, offset: CGFloat, transition: ContainedViewLayoutTransition) {

View File

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

View File

@ -239,9 +239,6 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
private var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode?
private var inputPanelBackgroundBlurMask: UIImageView?
private var inputPanelBackgroundBlurView: VariableBlurView?
private(set) var inputPanelNode: ChatInputPanelNode?
private weak var currentDismissedInputPanelNode: ChatInputPanelNode?
private(set) var secondaryInputPanelNode: ChatInputPanelNode?
@ -2144,11 +2141,15 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
var inputPanelHideOffset: CGFloat = 0.0
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 {
inputPanelHideOffset += -inputPanelSize.height - 80.0
inputPanelHideOffset += -inputPanelSize.height - additionalOffset
}
if let accessoryPanelSize = accessoryPanelSize {
inputPanelHideOffset += -accessoryPanelSize.height - 80.0
inputPanelHideOffset += -accessoryPanelSize.height - additionalOffset
}
}
@ -2203,82 +2204,27 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
}
}
if "".isEmpty {
var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode?
if let current = self.bottomBackgroundEdgeEffectNode {
bottomBackgroundEdgeEffectNode = current
} else {
if let value = self.backgroundNode.makeEdgeEffectNode() {
bottomBackgroundEdgeEffectNode = value
self.bottomBackgroundEdgeEffectNode = value
self.historyNodeContainer.view.superview?.insertSubview(value.view, aboveSubview: self.historyNodeContainer.view)
}
}
if let bottomBackgroundEdgeEffectNode {
var blurFrame = inputBackgroundFrame
blurFrame.origin.y -= 26.0
blurFrame.size.height += 100.0
transition.updateFrame(node: bottomBackgroundEdgeEffectNode, frame: blurFrame)
bottomBackgroundEdgeEffectNode.update(
rect: blurFrame,
edge: WallpaperEdgeEffectEdge(edge: .bottom, size: 80.0),
containerSize: wallpaperBounds.size,
transition: transition
)
var bottomBackgroundEdgeEffectNode: WallpaperEdgeEffectNode?
if let current = self.bottomBackgroundEdgeEffectNode {
bottomBackgroundEdgeEffectNode = current
} else {
if let value = self.backgroundNode.makeEdgeEffectNode() {
bottomBackgroundEdgeEffectNode = value
self.bottomBackgroundEdgeEffectNode = value
self.historyNodeContainer.view.superview?.insertSubview(value.view, aboveSubview: self.historyNodeContainer.view)
}
}
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
}
if let bottomBackgroundEdgeEffectNode {
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))
blurFrame.origin.y -= 26.0
blurFrame.size.height = max(100.0, layout.size.height - blurFrame.origin.y)
transition.updateFrame(node: bottomBackgroundEdgeEffectNode, frame: blurFrame)
bottomBackgroundEdgeEffectNode.update(
rect: blurFrame,
edge: WallpaperEdgeEffectEdge(edge: .bottom, size: 80.0),
containerSize: wallpaperBounds.size,
transition: transition
)
}
let additionalScrollDistance: CGFloat = 0.0
@ -3400,6 +3346,8 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate {
inlineSearchResultsView.layer.allowsGroupOpacity = true
if let emptyNode = self.emptyNode {
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 {
self.contentContainerNode.contentNode.view.insertSubview(inlineSearchResultsView, aboveSubview: self.historyNodeContainer.view)
}

View File

@ -332,7 +332,7 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode {
buttonView.alpha = 0.0
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
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))
@ -499,7 +499,10 @@ final class ChatTagSearchInputPanelNode: ChatInputPanelNode {
environment: {},
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
if let resultsTextView = resultsText.view {
if resultsTextView.superview == nil {

View File

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