mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-24 07:05:35 +00:00
Various fixes
This commit is contained in:
@@ -12,7 +12,7 @@ private let titleFont = Font.medium(16.0)
|
||||
|
||||
private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
private let backgroundBlurNode: NavigationBackgroundNode
|
||||
private let backgroundMaskNode: ASImageNode
|
||||
|
||||
private var titleNode: TextNode?
|
||||
private var iconNode: ASImageNode?
|
||||
private var buttonView: HighlightTrackingButton?
|
||||
@@ -35,9 +35,6 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
self.backgroundBlurNode = NavigationBackgroundNode(color: .clear)
|
||||
self.backgroundBlurNode.isUserInteractionEnabled = false
|
||||
|
||||
self.backgroundMaskNode = ASImageNode()
|
||||
self.backgroundMaskNode.isUserInteractionEnabled = false
|
||||
|
||||
self.accessibilityArea = AccessibilityAreaNode()
|
||||
self.accessibilityArea.accessibilityTraits = .button
|
||||
|
||||
@@ -159,18 +156,6 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
let messageTheme = incoming ? theme.theme.chat.message.incoming : theme.theme.chat.message.outgoing
|
||||
let (titleSize, titleApply) = titleLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: title, font: titleFont, textColor: bubbleVariableColor(variableColor: messageTheme.actionButtonsTextColor, wallpaper: theme.wallpaper)), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: CGSize(width: max(44.0, constrainedWidth - minimumSideInset - minimumSideInset), height: CGFloat.greatestFiniteMagnitude), alignment: .center, cutout: nil, insets: UIEdgeInsets(top: 1.0, left: 0.0, bottom: 1.0, right: 0.0)))
|
||||
|
||||
let backgroundMaskImage: UIImage?
|
||||
switch position {
|
||||
case .middle:
|
||||
backgroundMaskImage = graphics.chatBubbleActionButtonMiddleMaskImage
|
||||
case .bottomLeft:
|
||||
backgroundMaskImage = graphics.chatBubbleActionButtonBottomLeftMaskImage
|
||||
case .bottomRight:
|
||||
backgroundMaskImage = graphics.chatBubbleActionButtonBottomRightMaskImage
|
||||
case .bottomSingle:
|
||||
backgroundMaskImage = graphics.chatBubbleActionButtonBottomSingleMaskImage
|
||||
}
|
||||
|
||||
return (titleSize.size.width + sideInset + sideInset, { width in
|
||||
return (CGSize(width: width, height: 42.0), { animation in
|
||||
var animation = animation
|
||||
@@ -194,11 +179,8 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
node.longTapRecognizer?.isEnabled = false
|
||||
}
|
||||
|
||||
node.backgroundMaskNode.image = backgroundMaskImage
|
||||
animation.animator.updateFrame(layer: node.backgroundMaskNode.layer, frame: CGRect(origin: CGPoint(), size: CGSize(width: max(0.0, width), height: 42.0)), completion: nil)
|
||||
|
||||
animation.animator.updateFrame(layer: node.backgroundBlurNode.layer, frame: CGRect(origin: CGPoint(), size: CGSize(width: max(0.0, width), height: 42.0)), completion: nil)
|
||||
node.backgroundBlurNode.update(size: node.backgroundBlurNode.bounds.size, cornerRadius: bubbleCorners.auxiliaryRadius, animator: animation.animator)
|
||||
node.backgroundBlurNode.update(size: node.backgroundBlurNode.bounds.size, cornerRadius: 0.0, animator: animation.animator)
|
||||
node.backgroundBlurNode.updateColor(color: selectDateFillStaticColor(theme: theme.theme, wallpaper: theme.wallpaper), enableBlur: dateFillNeedsBlur(theme: theme.theme, wallpaper: theme.wallpaper), transition: .immediate)
|
||||
|
||||
if backgroundNode?.hasExtraBubbleBackground() == true {
|
||||
@@ -222,10 +204,12 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
node.backgroundColorNode = nil
|
||||
}
|
||||
|
||||
node.cornerRadius = bubbleCorners.auxiliaryRadius
|
||||
node.clipsToBounds = true
|
||||
|
||||
if let backgroundContent = node.backgroundContent {
|
||||
node.backgroundBlurNode.isHidden = true
|
||||
backgroundContent.frame = node.backgroundBlurNode.frame
|
||||
backgroundContent.cornerRadius = bubbleCorners.auxiliaryRadius
|
||||
|
||||
node.backgroundColorNode?.frame = backgroundContent.bounds
|
||||
|
||||
@@ -239,6 +223,16 @@ private final class ChatMessageActionButtonNode: ASDisplayNode {
|
||||
node.backgroundBlurNode.isHidden = false
|
||||
}
|
||||
|
||||
if position == .bottomSingle {
|
||||
let rect = node.backgroundBlurNode.bounds
|
||||
let maskPath = UIBezierPath(roundRect: rect, topLeftRadius: bubbleCorners.auxiliaryRadius, topRightRadius: bubbleCorners.auxiliaryRadius, bottomLeftRadius: bubbleCorners.mainRadius, bottomRightRadius: bubbleCorners.mainRadius)
|
||||
let shape = CAShapeLayer()
|
||||
shape.path = maskPath.cgPath
|
||||
node.layer.mask = shape
|
||||
} else {
|
||||
node.layer.mask = nil
|
||||
}
|
||||
|
||||
if iconImage != nil {
|
||||
if node.iconNode == nil {
|
||||
let iconNode = ASImageNode()
|
||||
|
||||
Reference in New Issue
Block a user