mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-23 14:45:21 +00:00
Various improvements
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user