mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-24 06:21:55 +00:00
Fix sticker reply and forward panels
This commit is contained in:
parent
53634ad77a
commit
127792bdd2
@ -806,6 +806,7 @@ private final class QuoteBackgroundView: UIView {
|
|||||||
|
|
||||||
self.backgroundView.update(
|
self.backgroundView.update(
|
||||||
size: size,
|
size: size,
|
||||||
|
isTransparent: false,
|
||||||
primaryColor: theme.foreground,
|
primaryColor: theme.foreground,
|
||||||
secondaryColor: theme.lineStyle != .solid ? .clear : nil,
|
secondaryColor: theme.lineStyle != .solid ? .clear : nil,
|
||||||
thirdColor: theme.lineStyle == .tripleDashed ? .clear : nil,
|
thirdColor: theme.lineStyle == .tripleDashed ? .clear : nil,
|
||||||
|
@ -114,8 +114,8 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
private var threadInfoNode: ChatMessageThreadInfoNode?
|
private var threadInfoNode: ChatMessageThreadInfoNode?
|
||||||
private var replyInfoNode: ChatMessageReplyInfoNode?
|
private var replyInfoNode: ChatMessageReplyInfoNode?
|
||||||
private var replyBackgroundContent: WallpaperBubbleBackgroundNode?
|
private var replyBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||||
private var replyBackgroundNode: NavigationBackgroundNode?
|
|
||||||
private var forwardInfoNode: ChatMessageForwardInfoNode?
|
private var forwardInfoNode: ChatMessageForwardInfoNode?
|
||||||
|
private var forwardBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||||
|
|
||||||
private var actionButtonsNode: ChatMessageActionButtonsNode?
|
private var actionButtonsNode: ChatMessageActionButtonsNode?
|
||||||
private var reactionButtonsNode: ChatMessageReactionButtonsNode?
|
private var reactionButtonsNode: ChatMessageReactionButtonsNode?
|
||||||
@ -1058,7 +1058,6 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
var viaBotApply: (TextNodeLayout, () -> TextNode)?
|
var viaBotApply: (TextNodeLayout, () -> TextNode)?
|
||||||
var threadInfoApply: (CGSize, (Bool) -> ChatMessageThreadInfoNode)?
|
var threadInfoApply: (CGSize, (Bool) -> ChatMessageThreadInfoNode)?
|
||||||
var replyInfoApply: (CGSize, (CGSize, Bool, ListViewItemUpdateAnimation) -> ChatMessageReplyInfoNode)?
|
var replyInfoApply: (CGSize, (CGSize, Bool, ListViewItemUpdateAnimation) -> ChatMessageReplyInfoNode)?
|
||||||
var needsReplyBackground = false
|
|
||||||
var replyMarkup: ReplyMarkupMessageAttribute?
|
var replyMarkup: ReplyMarkupMessageAttribute?
|
||||||
|
|
||||||
var availableContentWidth = min(200.0, max(60.0, params.width - params.leftInset - params.rightInset - max(imageSize.width, 160.0) - 20.0 - layoutConstants.bubble.edgeInset * 2.0 - avatarInset - layoutConstants.bubble.contentInsets.left))
|
var availableContentWidth = min(200.0, max(60.0, params.width - params.leftInset - params.rightInset - max(imageSize.width, 160.0) - 20.0 - layoutConstants.bubble.edgeInset * 2.0 - avatarInset - layoutConstants.bubble.contentInsets.left))
|
||||||
@ -1216,10 +1215,16 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
forwardInfoSizeApply = makeForwardInfoLayout(item.context, item.presentationData, item.presentationData.strings, .standalone, forwardSource, forwardAuthorSignature, forwardPsaType, nil, CGSize(width: availableWidth, height: CGFloat.greatestFiniteMagnitude))
|
||||||
}
|
}
|
||||||
|
|
||||||
if replyInfoApply != nil || viaBotApply != nil || forwardInfoSizeApply != nil {
|
var needsReplyBackground = false
|
||||||
|
if replyInfoApply != nil {
|
||||||
needsReplyBackground = true
|
needsReplyBackground = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var needsForwardBackground = false
|
||||||
|
if viaBotApply != nil || forwardInfoSizeApply != nil {
|
||||||
|
needsForwardBackground = true
|
||||||
|
}
|
||||||
|
|
||||||
var maxContentWidth = imageSize.width
|
var maxContentWidth = imageSize.width
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
@ -1272,6 +1277,53 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height
|
layoutSize.height += 4.0 + reactionButtonsSizeAndApply.0.height
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var headersOffset: CGFloat = 0.0
|
||||||
|
if let (threadInfoSize, _) = threadInfoApply {
|
||||||
|
headersOffset += threadInfoSize.height + 10.0
|
||||||
|
}
|
||||||
|
|
||||||
|
var viaBotFrame: CGRect?
|
||||||
|
if let (viaBotLayout, _) = viaBotApply {
|
||||||
|
viaBotFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 15.0) : (params.width - params.rightInset - viaBotLayout.size.width - layoutConstants.bubble.edgeInset - 14.0)), y: headersOffset + 8.0), size: viaBotLayout.size)
|
||||||
|
}
|
||||||
|
|
||||||
|
var replyInfoFrame: CGRect?
|
||||||
|
if let (replyInfoSize, _) = replyInfoApply {
|
||||||
|
var viaBotSize = CGSize()
|
||||||
|
if let viaBotFrame = viaBotFrame {
|
||||||
|
viaBotSize = viaBotFrame.size
|
||||||
|
}
|
||||||
|
let replyInfoFrameValue = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 10.0) : (params.width - params.rightInset - max(replyInfoSize.width, viaBotSize.width) - layoutConstants.bubble.edgeInset - 10.0)), y: headersOffset + 8.0 + viaBotSize.height), size: replyInfoSize)
|
||||||
|
replyInfoFrame = replyInfoFrameValue
|
||||||
|
if let viaBotFrameValue = viaBotFrame {
|
||||||
|
if replyInfoFrameValue.minX < replyInfoFrameValue.minX {
|
||||||
|
viaBotFrame = viaBotFrameValue.offsetBy(dx: replyInfoFrameValue.minX - viaBotFrameValue.minX, dy: 0.0)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var replyBackgroundFrame: CGRect?
|
||||||
|
if let replyInfoFrame = replyInfoFrame {
|
||||||
|
var viaBotSize = CGSize()
|
||||||
|
if let viaBotFrame = viaBotFrame {
|
||||||
|
viaBotSize = viaBotFrame.size
|
||||||
|
}
|
||||||
|
|
||||||
|
replyBackgroundFrame = CGRect(origin: CGPoint(x: replyInfoFrame.minX - 4.0, y: headersOffset + replyInfoFrame.minY - viaBotSize.height - 2.0), size: CGSize(width: max(replyInfoFrame.size.width, viaBotSize.width) + 8.0, height: replyInfoFrame.size.height + viaBotSize.height + 5.0))
|
||||||
|
}
|
||||||
|
let _ = replyBackgroundFrame
|
||||||
|
|
||||||
|
/*if let replyBackgroundFrameValue = replyBackgroundFrame {
|
||||||
|
if replyBackgroundFrameValue.insetBy(dx: -2.0, dy: -2.0).intersects(baseShareButtonFrame) {
|
||||||
|
let offset: CGFloat = 25.0
|
||||||
|
|
||||||
|
layoutSize.height += offset
|
||||||
|
updatedImageFrame.origin.y += offset
|
||||||
|
dateAndStatusFrame.origin.y += offset
|
||||||
|
baseShareButtonFrame.origin.y += offset
|
||||||
|
}
|
||||||
|
}*/
|
||||||
|
|
||||||
func finishLayout(_ animation: ListViewItemUpdateAnimation, _ apply: ListViewItemApply, _ synchronousLoads: Bool) {
|
func finishLayout(_ animation: ListViewItemUpdateAnimation, _ apply: ListViewItemApply, _ synchronousLoads: Bool) {
|
||||||
if let strongSelf = weakSelf.value {
|
if let strongSelf = weakSelf.value {
|
||||||
strongSelf.appliedForwardInfo = (forwardSource, forwardAuthorSignature)
|
strongSelf.appliedForwardInfo = (forwardSource, forwardAuthorSignature)
|
||||||
@ -1391,34 +1443,31 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
dateAndStatusApply(animation)
|
dateAndStatusApply(animation)
|
||||||
|
|
||||||
if needsReplyBackground {
|
if needsReplyBackground {
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
|
||||||
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
|
||||||
} else {
|
|
||||||
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
|
||||||
strongSelf.replyBackgroundNode = replyBackgroundNode
|
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
if item.controllerInteraction.presentationContext.backgroundNode?.hasExtraBubbleBackground() == true {
|
|
||||||
if strongSelf.replyBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
if strongSelf.replyBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
||||||
backgroundContent.clipsToBounds = true
|
backgroundContent.clipsToBounds = true
|
||||||
strongSelf.replyBackgroundContent = backgroundContent
|
strongSelf.replyBackgroundContent = backgroundContent
|
||||||
strongSelf.insertSubnode(backgroundContent, at: 0)
|
strongSelf.contextSourceNode.contentNode.insertSubnode(backgroundContent, at: 0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strongSelf.replyBackgroundContent?.removeFromSupernode()
|
|
||||||
strongSelf.replyBackgroundContent = nil
|
|
||||||
}
|
|
||||||
} else if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
|
||||||
strongSelf.replyBackgroundNode = nil
|
|
||||||
replyBackgroundNode.removeFromSupernode()
|
|
||||||
|
|
||||||
if let replyBackgroundContent = strongSelf.replyBackgroundContent {
|
if let replyBackgroundContent = strongSelf.replyBackgroundContent {
|
||||||
replyBackgroundContent.removeFromSupernode()
|
replyBackgroundContent.removeFromSupernode()
|
||||||
strongSelf.replyBackgroundContent = nil
|
strongSelf.replyBackgroundContent = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if needsForwardBackground {
|
||||||
|
if strongSelf.forwardBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
||||||
|
backgroundContent.clipsToBounds = true
|
||||||
|
strongSelf.forwardBackgroundContent = backgroundContent
|
||||||
|
strongSelf.contextSourceNode.contentNode.insertSubnode(backgroundContent, at: 0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let forwardBackgroundContent = strongSelf.forwardBackgroundContent {
|
||||||
|
forwardBackgroundContent.removeFromSupernode()
|
||||||
|
strongSelf.forwardBackgroundContent = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var headersOffset: CGFloat = 0.0
|
var headersOffset: CGFloat = 0.0
|
||||||
if let (threadInfoSize, threadInfoApply) = threadInfoApply {
|
if let (threadInfoSize, threadInfoApply) = threadInfoApply {
|
||||||
let threadInfoNode = threadInfoApply(synchronousLoads)
|
let threadInfoNode = threadInfoApply(synchronousLoads)
|
||||||
@ -1446,16 +1495,24 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
messageInfoSize = CGSize(width: max(messageInfoSize.width, replyInfoSize.width), height: 0.0)
|
messageInfoSize = CGSize(width: max(messageInfoSize.width, replyInfoSize.width), height: 0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var forwardAreaFrame: CGRect?
|
||||||
if let (viaBotLayout, viaBotApply) = viaBotApply, forwardInfoSizeApply == nil {
|
if let (viaBotLayout, viaBotApply) = viaBotApply, forwardInfoSizeApply == nil {
|
||||||
let viaBotNode = viaBotApply()
|
let viaBotNode = viaBotApply()
|
||||||
if strongSelf.viaBotNode == nil {
|
if strongSelf.viaBotNode == nil {
|
||||||
strongSelf.viaBotNode = viaBotNode
|
strongSelf.viaBotNode = viaBotNode
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(viaBotNode)
|
strongSelf.contextSourceNode.contentNode.addSubnode(viaBotNode)
|
||||||
}
|
}
|
||||||
let viaBotFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0), size: viaBotLayout.size)
|
let viaBotFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0 + 5.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0 - 5.0)), y: headersOffset + 8.0), size: viaBotLayout.size)
|
||||||
|
|
||||||
viaBotNode.frame = viaBotFrame
|
viaBotNode.frame = viaBotFrame
|
||||||
|
|
||||||
messageInfoSize = CGSize(width: messageInfoSize.width, height: viaBotLayout.size.height)
|
messageInfoSize = CGSize(width: messageInfoSize.width, height: viaBotLayout.size.height)
|
||||||
|
|
||||||
|
if let forwardAreaFrameValue = forwardAreaFrame {
|
||||||
|
forwardAreaFrame = forwardAreaFrameValue.union(viaBotFrame)
|
||||||
|
} else {
|
||||||
|
forwardAreaFrame = viaBotFrame
|
||||||
|
}
|
||||||
} else if let viaBotNode = strongSelf.viaBotNode {
|
} else if let viaBotNode = strongSelf.viaBotNode {
|
||||||
viaBotNode.removeFromSupernode()
|
viaBotNode.removeFromSupernode()
|
||||||
strongSelf.viaBotNode = nil
|
strongSelf.viaBotNode = nil
|
||||||
@ -1471,10 +1528,16 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
forwardInfoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
forwardInfoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let forwardInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 12.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 8.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: forwardInfoSize)
|
let forwardInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 12.0 + 5.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 8.0 - 5.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: forwardInfoSize)
|
||||||
forwardInfoNode.frame = forwardInfoFrame
|
forwardInfoNode.frame = forwardInfoFrame
|
||||||
|
|
||||||
messageInfoSize = CGSize(width: messageInfoSize.width, height: messageInfoSize.height + forwardInfoSize.height - 1.0)
|
messageInfoSize = CGSize(width: messageInfoSize.width, height: messageInfoSize.height + forwardInfoSize.height + 8.0)
|
||||||
|
|
||||||
|
if let forwardAreaFrameValue = forwardAreaFrame {
|
||||||
|
forwardAreaFrame = forwardAreaFrameValue.union(forwardInfoFrame)
|
||||||
|
} else {
|
||||||
|
forwardAreaFrame = forwardInfoFrame
|
||||||
|
}
|
||||||
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||||
if animation.isAnimated {
|
if animation.isAnimated {
|
||||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||||
@ -1489,9 +1552,18 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var forwardBackgroundFrame: CGRect?
|
||||||
|
if let forwardAreaFrame {
|
||||||
|
forwardBackgroundFrame = forwardAreaFrame.insetBy(dx: -6.0, dy: -3.0)
|
||||||
|
}
|
||||||
|
|
||||||
var replyBackgroundFrame: CGRect?
|
var replyBackgroundFrame: CGRect?
|
||||||
if let (replyInfoSize, replyInfoApply) = replyInfoApply {
|
if let (replyInfoSize, replyInfoApply) = replyInfoApply {
|
||||||
let replyInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: replyInfoSize)
|
if headersOffset != 0.0 {
|
||||||
|
headersOffset += 6.0
|
||||||
|
}
|
||||||
|
|
||||||
|
let replyInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - replyInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: replyInfoSize)
|
||||||
replyBackgroundFrame = replyInfoFrame
|
replyBackgroundFrame = replyInfoFrame
|
||||||
|
|
||||||
let replyInfoNode = replyInfoApply(replyInfoFrame.size, synchronousLoads, animation)
|
let replyInfoNode = replyInfoApply(replyInfoFrame.size, synchronousLoads, animation)
|
||||||
@ -1507,24 +1579,25 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
strongSelf.replyInfoNode = nil
|
strongSelf.replyInfoNode = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode, let replyBackgroundFrame {
|
if let backgroundContent = strongSelf.replyBackgroundContent, let replyBackgroundFrame {
|
||||||
replyBackgroundNode.frame = replyBackgroundFrame
|
backgroundContent.cornerRadius = 4.0
|
||||||
|
backgroundContent.frame = replyBackgroundFrame
|
||||||
let cornerRadius = 4.0
|
|
||||||
replyBackgroundNode.update(size: replyBackgroundNode.bounds.size, cornerRadius: cornerRadius, transition: .immediate)
|
|
||||||
|
|
||||||
if let backgroundContent = strongSelf.replyBackgroundContent {
|
|
||||||
replyBackgroundNode.isHidden = true
|
|
||||||
backgroundContent.cornerRadius = cornerRadius
|
|
||||||
backgroundContent.frame = replyBackgroundNode.frame
|
|
||||||
if let (rect, containerSize) = strongSelf.absoluteRect {
|
if let (rect, containerSize) = strongSelf.absoluteRect {
|
||||||
var backgroundFrame = backgroundContent.frame
|
var backgroundFrame = backgroundContent.frame
|
||||||
backgroundFrame.origin.x += rect.minX
|
backgroundFrame.origin.x += rect.minX
|
||||||
backgroundFrame.origin.y += rect.minY
|
backgroundFrame.origin.y += rect.minY
|
||||||
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
replyBackgroundNode.isHidden = false
|
|
||||||
|
if let backgroundContent = strongSelf.forwardBackgroundContent, let forwardBackgroundFrame {
|
||||||
|
backgroundContent.cornerRadius = 4.0
|
||||||
|
backgroundContent.frame = forwardBackgroundFrame
|
||||||
|
if let (rect, containerSize) = strongSelf.absoluteRect {
|
||||||
|
var backgroundFrame = backgroundContent.frame
|
||||||
|
backgroundFrame.origin.x += rect.minX
|
||||||
|
backgroundFrame.origin.y += rect.minY
|
||||||
|
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1533,7 +1606,8 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
strongSelf.replyInfoNode?.alpha = panelsAlpha
|
strongSelf.replyInfoNode?.alpha = panelsAlpha
|
||||||
strongSelf.viaBotNode?.alpha = panelsAlpha
|
strongSelf.viaBotNode?.alpha = panelsAlpha
|
||||||
strongSelf.forwardInfoNode?.alpha = panelsAlpha
|
strongSelf.forwardInfoNode?.alpha = panelsAlpha
|
||||||
strongSelf.replyBackgroundNode?.alpha = panelsAlpha
|
strongSelf.replyBackgroundContent?.alpha = panelsAlpha
|
||||||
|
strongSelf.forwardBackgroundContent?.alpha = panelsAlpha
|
||||||
|
|
||||||
if isFailed {
|
if isFailed {
|
||||||
let deliveryFailedNode: ChatMessageDeliveryFailedNode
|
let deliveryFailedNode: ChatMessageDeliveryFailedNode
|
||||||
@ -2445,8 +2519,11 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
if let forwardInfoNode = self.forwardInfoNode {
|
if let forwardInfoNode = self.forwardInfoNode {
|
||||||
transition.updateAlpha(node: forwardInfoNode, alpha: panelsAlpha)
|
transition.updateAlpha(node: forwardInfoNode, alpha: panelsAlpha)
|
||||||
}
|
}
|
||||||
if let replyBackgroundNode = self.replyBackgroundNode {
|
if let replyBackgroundContent = self.replyBackgroundContent {
|
||||||
transition.updateAlpha(node: replyBackgroundNode, alpha: panelsAlpha)
|
transition.updateAlpha(node: replyBackgroundContent, alpha: panelsAlpha)
|
||||||
|
}
|
||||||
|
if let forwardBackgroundContent = self.forwardBackgroundContent {
|
||||||
|
transition.updateAlpha(node: forwardBackgroundContent, alpha: panelsAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let selectionState = item.controllerInteraction.selectionState {
|
if let selectionState = item.controllerInteraction.selectionState {
|
||||||
@ -2814,9 +2891,13 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
|
|||||||
relativeTargetRect: sourceReplyPanel.relativeTargetRect
|
relativeTargetRect: sourceReplyPanel.relativeTargetRect
|
||||||
)
|
)
|
||||||
let offset = replyInfoNode.animateFromInputPanel(sourceReplyPanel: mappedPanel, localRect: localRect, transition: transition)
|
let offset = replyInfoNode.animateFromInputPanel(sourceReplyPanel: mappedPanel, localRect: localRect, transition: transition)
|
||||||
if let replyBackgroundNode = self.replyBackgroundNode {
|
if let replyBackgroundContent = self.replyBackgroundContent {
|
||||||
transition.animatePositionAdditive(layer: replyBackgroundNode.layer, offset: offset)
|
transition.animatePositionAdditive(layer: replyBackgroundContent.layer, offset: offset)
|
||||||
replyBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
replyBackgroundContent.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||||
|
}
|
||||||
|
if let forwardBackgroundContent = self.forwardBackgroundContent {
|
||||||
|
transition.animatePositionAdditive(layer: forwardBackgroundContent.layer, offset: offset)
|
||||||
|
forwardBackgroundContent.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -869,13 +869,13 @@ public final class ChatMessageAttachedContentNode: ASDisplayNode {
|
|||||||
if let current = self.backgroundView {
|
if let current = self.backgroundView {
|
||||||
backgroundView = current
|
backgroundView = current
|
||||||
animation.animator.updateFrame(layer: backgroundView.layer, frame: backgroundFrame, completion: nil)
|
animation.animator.updateFrame(layer: backgroundView.layer, frame: backgroundFrame, completion: nil)
|
||||||
backgroundView.update(size: backgroundFrame.size, primaryColor: mainColor, secondaryColor: secondaryColor, thirdColor: tertiaryColor, pattern: nil, animation: animation)
|
backgroundView.update(size: backgroundFrame.size, isTransparent: false, primaryColor: mainColor, secondaryColor: secondaryColor, thirdColor: tertiaryColor, pattern: nil, animation: animation)
|
||||||
} else {
|
} else {
|
||||||
backgroundView = MessageInlineBlockBackgroundView()
|
backgroundView = MessageInlineBlockBackgroundView()
|
||||||
self.backgroundView = backgroundView
|
self.backgroundView = backgroundView
|
||||||
backgroundView.frame = backgroundFrame
|
backgroundView.frame = backgroundFrame
|
||||||
self.transformContainer.view.insertSubview(backgroundView, at: 0)
|
self.transformContainer.view.insertSubview(backgroundView, at: 0)
|
||||||
backgroundView.update(size: backgroundFrame.size, primaryColor: mainColor, secondaryColor: secondaryColor, thirdColor: tertiaryColor, pattern: nil, animation: .None)
|
backgroundView.update(size: backgroundFrame.size, isTransparent: false, primaryColor: mainColor, secondaryColor: secondaryColor, thirdColor: tertiaryColor, pattern: nil, animation: .None)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if let backgroundView = self.backgroundView {
|
if let backgroundView = self.backgroundView {
|
||||||
|
@ -769,8 +769,13 @@ public class ChatMessageReplyInfoNode: ASDisplayNode {
|
|||||||
)] as? TelegramMediaFile
|
)] as? TelegramMediaFile
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
var isTransparent: Bool = false
|
||||||
|
if case .standalone = arguments.type {
|
||||||
|
isTransparent = true
|
||||||
|
}
|
||||||
node.backgroundView.update(
|
node.backgroundView.update(
|
||||||
size: backgroundFrame.size,
|
size: backgroundFrame.size,
|
||||||
|
isTransparent: isTransparent,
|
||||||
primaryColor: mainColor,
|
primaryColor: mainColor,
|
||||||
secondaryColor: secondaryColor,
|
secondaryColor: secondaryColor,
|
||||||
thirdColor: tertiaryColor,
|
thirdColor: tertiaryColor,
|
||||||
|
@ -56,8 +56,8 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
private var threadInfoNode: ChatMessageThreadInfoNode?
|
private var threadInfoNode: ChatMessageThreadInfoNode?
|
||||||
private var replyInfoNode: ChatMessageReplyInfoNode?
|
private var replyInfoNode: ChatMessageReplyInfoNode?
|
||||||
private var replyBackgroundContent: WallpaperBubbleBackgroundNode?
|
private var replyBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||||
private var replyBackgroundNode: NavigationBackgroundNode?
|
|
||||||
private var forwardInfoNode: ChatMessageForwardInfoNode?
|
private var forwardInfoNode: ChatMessageForwardInfoNode?
|
||||||
|
private var forwardBackgroundContent: WallpaperBubbleBackgroundNode?
|
||||||
|
|
||||||
private var actionButtonsNode: ChatMessageActionButtonsNode?
|
private var actionButtonsNode: ChatMessageActionButtonsNode?
|
||||||
private var reactionButtonsNode: ChatMessageReactionButtonsNode?
|
private var reactionButtonsNode: ChatMessageReactionButtonsNode?
|
||||||
@ -350,6 +350,14 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
|
|
||||||
replyBackgroundContent.update(rect: rect, within: containerSize, transition: .immediate)
|
replyBackgroundContent.update(rect: rect, within: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if let forwardBackgroundContent = self.forwardBackgroundContent {
|
||||||
|
var forwardBackgroundContentFrame = forwardBackgroundContent.frame
|
||||||
|
forwardBackgroundContentFrame.origin.x += rect.minX
|
||||||
|
forwardBackgroundContentFrame.origin.y += rect.minY
|
||||||
|
|
||||||
|
forwardBackgroundContent.update(rect: rect, within: containerSize, transition: .immediate)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -784,10 +792,15 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var needsReplyBackground = false
|
var needsReplyBackground = false
|
||||||
if replyInfoApply != nil || viaBotApply != nil || forwardInfoSizeApply != nil {
|
if replyInfoApply != nil {
|
||||||
needsReplyBackground = true
|
needsReplyBackground = true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var needsForwardBackground = false
|
||||||
|
if viaBotApply != nil || forwardInfoSizeApply != nil {
|
||||||
|
needsForwardBackground = true
|
||||||
|
}
|
||||||
|
|
||||||
var maxContentWidth = imageSize.width
|
var maxContentWidth = imageSize.width
|
||||||
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
var actionButtonsFinalize: ((CGFloat) -> (CGSize, (_ animation: ListViewItemUpdateAnimation) -> ChatMessageActionButtonsNode))?
|
||||||
if let replyMarkup = replyMarkup {
|
if let replyMarkup = replyMarkup {
|
||||||
@ -971,34 +984,31 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if needsReplyBackground {
|
if needsReplyBackground {
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
|
||||||
replyBackgroundNode.updateColor(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), transition: .immediate)
|
|
||||||
} else {
|
|
||||||
let replyBackgroundNode = NavigationBackgroundNode(color: selectDateFillStaticColor(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper), enableBlur: item.controllerInteraction.enableFullTranslucency && dateFillNeedsBlur(theme: item.presentationData.theme.theme, wallpaper: item.presentationData.theme.wallpaper))
|
|
||||||
strongSelf.replyBackgroundNode = replyBackgroundNode
|
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(replyBackgroundNode)
|
|
||||||
}
|
|
||||||
|
|
||||||
if item.controllerInteraction.presentationContext.backgroundNode?.hasExtraBubbleBackground() == true {
|
|
||||||
if strongSelf.replyBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
if strongSelf.replyBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
||||||
backgroundContent.clipsToBounds = true
|
backgroundContent.clipsToBounds = true
|
||||||
strongSelf.replyBackgroundContent = backgroundContent
|
strongSelf.replyBackgroundContent = backgroundContent
|
||||||
strongSelf.insertSubnode(backgroundContent, at: 0)
|
strongSelf.contextSourceNode.contentNode.insertSubnode(backgroundContent, at: 0)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
strongSelf.replyBackgroundContent?.removeFromSupernode()
|
|
||||||
strongSelf.replyBackgroundContent = nil
|
|
||||||
}
|
|
||||||
} else if let replyBackgroundNode = strongSelf.replyBackgroundNode {
|
|
||||||
replyBackgroundNode.removeFromSupernode()
|
|
||||||
strongSelf.replyBackgroundNode = nil
|
|
||||||
|
|
||||||
if let replyBackgroundContent = strongSelf.replyBackgroundContent {
|
if let replyBackgroundContent = strongSelf.replyBackgroundContent {
|
||||||
replyBackgroundContent.removeFromSupernode()
|
replyBackgroundContent.removeFromSupernode()
|
||||||
strongSelf.replyBackgroundContent = nil
|
strongSelf.replyBackgroundContent = nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if needsForwardBackground {
|
||||||
|
if strongSelf.forwardBackgroundContent == nil, let backgroundContent = item.controllerInteraction.presentationContext.backgroundNode?.makeBubbleBackground(for: .free) {
|
||||||
|
backgroundContent.clipsToBounds = true
|
||||||
|
strongSelf.forwardBackgroundContent = backgroundContent
|
||||||
|
strongSelf.contextSourceNode.contentNode.insertSubnode(backgroundContent, at: 0)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
if let forwardBackgroundContent = strongSelf.forwardBackgroundContent {
|
||||||
|
forwardBackgroundContent.removeFromSupernode()
|
||||||
|
strongSelf.forwardBackgroundContent = nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
var headersOffset: CGFloat = 0.0
|
var headersOffset: CGFloat = 0.0
|
||||||
if let (threadInfoSize, threadInfoApply) = threadInfoApply {
|
if let (threadInfoSize, threadInfoApply) = threadInfoApply {
|
||||||
let threadInfoNode = threadInfoApply(synchronousLoads)
|
let threadInfoNode = threadInfoApply(synchronousLoads)
|
||||||
@ -1026,16 +1036,24 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
messageInfoSize = CGSize(width: max(messageInfoSize.width, replyInfoSize.width), height: 0.0)
|
messageInfoSize = CGSize(width: max(messageInfoSize.width, replyInfoSize.width), height: 0.0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var forwardAreaFrame: CGRect?
|
||||||
if let (viaBotLayout, viaBotApply) = viaBotApply, forwardInfoSizeApply == nil {
|
if let (viaBotLayout, viaBotApply) = viaBotApply, forwardInfoSizeApply == nil {
|
||||||
let viaBotNode = viaBotApply()
|
let viaBotNode = viaBotApply()
|
||||||
if strongSelf.viaBotNode == nil {
|
if strongSelf.viaBotNode == nil {
|
||||||
strongSelf.viaBotNode = viaBotNode
|
strongSelf.viaBotNode = viaBotNode
|
||||||
strongSelf.contextSourceNode.contentNode.addSubnode(viaBotNode)
|
strongSelf.contextSourceNode.contentNode.addSubnode(viaBotNode)
|
||||||
}
|
}
|
||||||
let viaBotFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0), size: viaBotLayout.size)
|
let viaBotFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0 + 5.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0 - 5.0)), y: headersOffset + 8.0), size: viaBotLayout.size)
|
||||||
|
|
||||||
viaBotNode.frame = viaBotFrame
|
viaBotNode.frame = viaBotFrame
|
||||||
|
|
||||||
messageInfoSize = CGSize(width: messageInfoSize.width, height: viaBotLayout.size.height)
|
messageInfoSize = CGSize(width: messageInfoSize.width, height: viaBotLayout.size.height)
|
||||||
|
|
||||||
|
if let forwardAreaFrameValue = forwardAreaFrame {
|
||||||
|
forwardAreaFrame = forwardAreaFrameValue.union(viaBotFrame)
|
||||||
|
} else {
|
||||||
|
forwardAreaFrame = viaBotFrame
|
||||||
|
}
|
||||||
} else if let viaBotNode = strongSelf.viaBotNode {
|
} else if let viaBotNode = strongSelf.viaBotNode {
|
||||||
viaBotNode.removeFromSupernode()
|
viaBotNode.removeFromSupernode()
|
||||||
strongSelf.viaBotNode = nil
|
strongSelf.viaBotNode = nil
|
||||||
@ -1051,10 +1069,16 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
forwardInfoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
forwardInfoNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
let forwardInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 12.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 8.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: forwardInfoSize)
|
let forwardInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 12.0 + 5.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 8.0 - 5.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: forwardInfoSize)
|
||||||
forwardInfoNode.frame = forwardInfoFrame
|
forwardInfoNode.frame = forwardInfoFrame
|
||||||
|
|
||||||
messageInfoSize = CGSize(width: messageInfoSize.width, height: messageInfoSize.height + forwardInfoSize.height - 1.0)
|
messageInfoSize = CGSize(width: messageInfoSize.width, height: messageInfoSize.height + forwardInfoSize.height + 8.0)
|
||||||
|
|
||||||
|
if let forwardAreaFrameValue = forwardAreaFrame {
|
||||||
|
forwardAreaFrame = forwardAreaFrameValue.union(forwardInfoFrame)
|
||||||
|
} else {
|
||||||
|
forwardAreaFrame = forwardInfoFrame
|
||||||
|
}
|
||||||
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
} else if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||||
if animation.isAnimated {
|
if animation.isAnimated {
|
||||||
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
if let forwardInfoNode = strongSelf.forwardInfoNode {
|
||||||
@ -1069,9 +1093,18 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var forwardBackgroundFrame: CGRect?
|
||||||
|
if let forwardAreaFrame {
|
||||||
|
forwardBackgroundFrame = forwardAreaFrame.insetBy(dx: -6.0, dy: -3.0)
|
||||||
|
}
|
||||||
|
|
||||||
var replyBackgroundFrame: CGRect?
|
var replyBackgroundFrame: CGRect?
|
||||||
if let (replyInfoSize, replyInfoApply) = replyInfoApply {
|
if let (replyInfoSize, replyInfoApply) = replyInfoApply {
|
||||||
let replyInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - messageInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: replyInfoSize)
|
if headersOffset != 0.0 {
|
||||||
|
headersOffset += 6.0
|
||||||
|
}
|
||||||
|
|
||||||
|
let replyInfoFrame = CGRect(origin: CGPoint(x: (!incoming ? (params.leftInset + layoutConstants.bubble.edgeInset + 11.0) : (params.width - params.rightInset - replyInfoSize.width - layoutConstants.bubble.edgeInset - 9.0)), y: headersOffset + 8.0 + messageInfoSize.height), size: replyInfoSize)
|
||||||
replyBackgroundFrame = replyInfoFrame
|
replyBackgroundFrame = replyInfoFrame
|
||||||
|
|
||||||
let replyInfoNode = replyInfoApply(replyInfoFrame.size, synchronousLoads, animation)
|
let replyInfoNode = replyInfoApply(replyInfoFrame.size, synchronousLoads, animation)
|
||||||
@ -1087,24 +1120,25 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
strongSelf.replyInfoNode = nil
|
strongSelf.replyInfoNode = nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if let replyBackgroundNode = strongSelf.replyBackgroundNode, let replyBackgroundFrame {
|
if let backgroundContent = strongSelf.replyBackgroundContent, let replyBackgroundFrame {
|
||||||
replyBackgroundNode.frame = replyBackgroundFrame
|
backgroundContent.cornerRadius = 4.0
|
||||||
|
backgroundContent.frame = replyBackgroundFrame
|
||||||
let cornerRadius = 4.0
|
|
||||||
replyBackgroundNode.update(size: replyBackgroundNode.bounds.size, cornerRadius: cornerRadius, transition: .immediate)
|
|
||||||
|
|
||||||
if let backgroundContent = strongSelf.replyBackgroundContent {
|
|
||||||
replyBackgroundNode.isHidden = true
|
|
||||||
backgroundContent.cornerRadius = cornerRadius
|
|
||||||
backgroundContent.frame = replyBackgroundNode.frame
|
|
||||||
if let (rect, containerSize) = strongSelf.absoluteRect {
|
if let (rect, containerSize) = strongSelf.absoluteRect {
|
||||||
var backgroundFrame = backgroundContent.frame
|
var backgroundFrame = backgroundContent.frame
|
||||||
backgroundFrame.origin.x += rect.minX
|
backgroundFrame.origin.x += rect.minX
|
||||||
backgroundFrame.origin.y += rect.minY
|
backgroundFrame.origin.y += rect.minY
|
||||||
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
replyBackgroundNode.isHidden = false
|
|
||||||
|
if let backgroundContent = strongSelf.forwardBackgroundContent, let forwardBackgroundFrame {
|
||||||
|
backgroundContent.cornerRadius = 4.0
|
||||||
|
backgroundContent.frame = forwardBackgroundFrame
|
||||||
|
if let (rect, containerSize) = strongSelf.absoluteRect {
|
||||||
|
var backgroundFrame = backgroundContent.frame
|
||||||
|
backgroundFrame.origin.x += rect.minX
|
||||||
|
backgroundFrame.origin.y += rect.minY
|
||||||
|
backgroundContent.update(rect: backgroundFrame, within: containerSize, transition: .immediate)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1113,7 +1147,8 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
strongSelf.replyInfoNode?.alpha = panelsAlpha
|
strongSelf.replyInfoNode?.alpha = panelsAlpha
|
||||||
strongSelf.viaBotNode?.alpha = panelsAlpha
|
strongSelf.viaBotNode?.alpha = panelsAlpha
|
||||||
strongSelf.forwardInfoNode?.alpha = panelsAlpha
|
strongSelf.forwardInfoNode?.alpha = panelsAlpha
|
||||||
strongSelf.replyBackgroundNode?.alpha = panelsAlpha
|
strongSelf.replyBackgroundContent?.alpha = panelsAlpha
|
||||||
|
strongSelf.forwardBackgroundContent?.alpha = panelsAlpha
|
||||||
|
|
||||||
if isFailed {
|
if isFailed {
|
||||||
let deliveryFailedNode: ChatMessageDeliveryFailedNode
|
let deliveryFailedNode: ChatMessageDeliveryFailedNode
|
||||||
@ -1591,8 +1626,11 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
if let forwardInfoNode = self.forwardInfoNode {
|
if let forwardInfoNode = self.forwardInfoNode {
|
||||||
transition.updateAlpha(node: forwardInfoNode, alpha: panelsAlpha)
|
transition.updateAlpha(node: forwardInfoNode, alpha: panelsAlpha)
|
||||||
}
|
}
|
||||||
if let replyBackgroundNode = self.replyBackgroundNode {
|
if let replyBackgroundContent = self.replyBackgroundContent {
|
||||||
transition.updateAlpha(node: replyBackgroundNode, alpha: panelsAlpha)
|
transition.updateAlpha(node: replyBackgroundContent, alpha: panelsAlpha)
|
||||||
|
}
|
||||||
|
if let forwardBackgroundContent = self.forwardBackgroundContent {
|
||||||
|
transition.updateAlpha(node: forwardBackgroundContent, alpha: panelsAlpha)
|
||||||
}
|
}
|
||||||
|
|
||||||
if let selectionState = item.controllerInteraction.selectionState {
|
if let selectionState = item.controllerInteraction.selectionState {
|
||||||
@ -1635,10 +1673,10 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
let alpha: CGFloat = 0.0
|
let alpha: CGFloat = 0.0
|
||||||
let previousAlpha = replyInfoNode.alpha
|
let previousAlpha = replyInfoNode.alpha
|
||||||
replyInfoNode.alpha = alpha
|
replyInfoNode.alpha = alpha
|
||||||
self.replyBackgroundNode?.alpha = alpha
|
self.replyBackgroundContent?.alpha = alpha
|
||||||
if animated {
|
if animated {
|
||||||
replyInfoNode.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
replyInfoNode.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
||||||
self.replyBackgroundNode?.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
self.replyBackgroundContent?.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -1664,10 +1702,10 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
let alpha: CGFloat = 1.0
|
let alpha: CGFloat = 1.0
|
||||||
let previousAlpha = replyInfoNode.alpha
|
let previousAlpha = replyInfoNode.alpha
|
||||||
replyInfoNode.alpha = alpha
|
replyInfoNode.alpha = alpha
|
||||||
self.replyBackgroundNode?.alpha = alpha
|
self.replyBackgroundContent?.alpha = alpha
|
||||||
if animated {
|
if animated {
|
||||||
replyInfoNode.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
replyInfoNode.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
||||||
self.replyBackgroundNode?.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
self.replyBackgroundContent?.layer.animateAlpha(from: previousAlpha, to: alpha, duration: 0.3)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1957,9 +1995,13 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
|
|||||||
)
|
)
|
||||||
|
|
||||||
let offset = replyInfoNode.animateFromInputPanel(sourceReplyPanel: mappedPanel, localRect: localRect, transition: transition)
|
let offset = replyInfoNode.animateFromInputPanel(sourceReplyPanel: mappedPanel, localRect: localRect, transition: transition)
|
||||||
if let replyBackgroundNode = self.replyBackgroundNode {
|
if let replyBackgroundContent = self.replyBackgroundContent {
|
||||||
transition.animatePositionAdditive(layer: replyBackgroundNode.layer, offset: offset)
|
transition.animatePositionAdditive(layer: replyBackgroundContent.layer, offset: offset)
|
||||||
replyBackgroundNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
replyBackgroundContent.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||||
|
}
|
||||||
|
if let forwardBackgroundContent = self.forwardBackgroundContent {
|
||||||
|
transition.animatePositionAdditive(layer: forwardBackgroundContent.layer, offset: offset)
|
||||||
|
forwardBackgroundContent.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -28,7 +28,7 @@ private func addRoundedRectPath(context: CGContext, rect: CGRect, radius: CGFloa
|
|||||||
context.restoreGState()
|
context.restoreGState()
|
||||||
}
|
}
|
||||||
|
|
||||||
private func generateBackgroundTemplateImage(addStripe: Bool) -> UIImage {
|
private func generateBackgroundTemplateImage(addStripe: Bool, isTransparent: Bool) -> UIImage {
|
||||||
return generateImage(CGSize(width: radius * 2.0 + 4.0, height: radius * 2.0 + 8.0), rotatedContext: { size, context in
|
return generateImage(CGSize(width: radius * 2.0 + 4.0, height: radius * 2.0 + 8.0), rotatedContext: { size, context in
|
||||||
context.clear(CGRect(origin: CGPoint(), size: size))
|
context.clear(CGRect(origin: CGPoint(), size: size))
|
||||||
|
|
||||||
@ -36,7 +36,9 @@ private func generateBackgroundTemplateImage(addStripe: Bool) -> UIImage {
|
|||||||
context.clip()
|
context.clip()
|
||||||
|
|
||||||
context.setFillColor(UIColor.white.withMultipliedAlpha(0.1).cgColor)
|
context.setFillColor(UIColor.white.withMultipliedAlpha(0.1).cgColor)
|
||||||
|
if !isTransparent {
|
||||||
context.fill(CGRect(origin: CGPoint(), size: size))
|
context.fill(CGRect(origin: CGPoint(), size: size))
|
||||||
|
}
|
||||||
|
|
||||||
if addStripe {
|
if addStripe {
|
||||||
context.setFillColor(UIColor.white.withMultipliedAlpha(0.2).cgColor)
|
context.setFillColor(UIColor.white.withMultipliedAlpha(0.2).cgColor)
|
||||||
@ -69,11 +71,19 @@ private func generateProgressTemplateImage() -> UIImage {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private let backgroundSolidTemplateImage: UIImage = {
|
private let backgroundSolidTemplateImage: UIImage = {
|
||||||
return generateBackgroundTemplateImage(addStripe: true)
|
return generateBackgroundTemplateImage(addStripe: true, isTransparent: false)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private let backgroundDashTemplateImage: UIImage = {
|
private let backgroundDashTemplateImage: UIImage = {
|
||||||
return generateBackgroundTemplateImage(addStripe: false)
|
return generateBackgroundTemplateImage(addStripe: false, isTransparent: false)
|
||||||
|
}()
|
||||||
|
|
||||||
|
private let transparentBackgroundSolidTemplateImage: UIImage = {
|
||||||
|
return generateBackgroundTemplateImage(addStripe: true, isTransparent: true)
|
||||||
|
}()
|
||||||
|
|
||||||
|
private let transparentBackgroundDashTemplateImage: UIImage = {
|
||||||
|
return generateBackgroundTemplateImage(addStripe: false, isTransparent: true)
|
||||||
}()
|
}()
|
||||||
|
|
||||||
private func generateDashBackgroundTemplateImage() -> UIImage {
|
private func generateDashBackgroundTemplateImage() -> UIImage {
|
||||||
@ -436,6 +446,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
|
|
||||||
private struct Params: Equatable {
|
private struct Params: Equatable {
|
||||||
var size: CGSize
|
var size: CGSize
|
||||||
|
var isTransparent: Bool
|
||||||
var primaryColor: UIColor
|
var primaryColor: UIColor
|
||||||
var secondaryColor: UIColor?
|
var secondaryColor: UIColor?
|
||||||
var thirdColor: UIColor?
|
var thirdColor: UIColor?
|
||||||
@ -444,6 +455,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
|
|
||||||
init(
|
init(
|
||||||
size: CGSize,
|
size: CGSize,
|
||||||
|
isTransparent: Bool,
|
||||||
primaryColor: UIColor,
|
primaryColor: UIColor,
|
||||||
secondaryColor: UIColor?,
|
secondaryColor: UIColor?,
|
||||||
thirdColor: UIColor?,
|
thirdColor: UIColor?,
|
||||||
@ -451,6 +463,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
displayProgress: Bool
|
displayProgress: Bool
|
||||||
) {
|
) {
|
||||||
self.size = size
|
self.size = size
|
||||||
|
self.isTransparent = isTransparent
|
||||||
self.primaryColor = primaryColor
|
self.primaryColor = primaryColor
|
||||||
self.secondaryColor = secondaryColor
|
self.secondaryColor = secondaryColor
|
||||||
self.thirdColor = thirdColor
|
self.thirdColor = thirdColor
|
||||||
@ -467,6 +480,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
if let params = self.params {
|
if let params = self.params {
|
||||||
self.update(
|
self.update(
|
||||||
size: params.size,
|
size: params.size,
|
||||||
|
isTransparent: params.isTransparent,
|
||||||
primaryColor: params.primaryColor,
|
primaryColor: params.primaryColor,
|
||||||
secondaryColor: params.secondaryColor,
|
secondaryColor: params.secondaryColor,
|
||||||
thirdColor: params.thirdColor,
|
thirdColor: params.thirdColor,
|
||||||
@ -577,6 +591,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
|
|
||||||
public func update(
|
public func update(
|
||||||
size: CGSize,
|
size: CGSize,
|
||||||
|
isTransparent: Bool,
|
||||||
primaryColor: UIColor,
|
primaryColor: UIColor,
|
||||||
secondaryColor: UIColor?,
|
secondaryColor: UIColor?,
|
||||||
thirdColor: UIColor?,
|
thirdColor: UIColor?,
|
||||||
@ -585,6 +600,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
) {
|
) {
|
||||||
let params = Params(
|
let params = Params(
|
||||||
size: size,
|
size: size,
|
||||||
|
isTransparent: isTransparent,
|
||||||
primaryColor: primaryColor,
|
primaryColor: primaryColor,
|
||||||
secondaryColor: secondaryColor,
|
secondaryColor: secondaryColor,
|
||||||
thirdColor: thirdColor,
|
thirdColor: thirdColor,
|
||||||
@ -602,11 +618,19 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
patternContentLayer.layerTintColor = primaryColor.cgColor
|
patternContentLayer.layerTintColor = primaryColor.cgColor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if params.isTransparent {
|
||||||
|
if params.secondaryColor != nil {
|
||||||
|
self.backgroundView.image = transparentBackgroundDashTemplateImage
|
||||||
|
} else {
|
||||||
|
self.backgroundView.image = transparentBackgroundSolidTemplateImage
|
||||||
|
}
|
||||||
|
} else {
|
||||||
if params.secondaryColor != nil {
|
if params.secondaryColor != nil {
|
||||||
self.backgroundView.image = backgroundDashTemplateImage
|
self.backgroundView.image = backgroundDashTemplateImage
|
||||||
} else {
|
} else {
|
||||||
self.backgroundView.image = backgroundSolidTemplateImage
|
self.backgroundView.image = backgroundSolidTemplateImage
|
||||||
}
|
}
|
||||||
|
}
|
||||||
self.backgroundView.tintColor = params.primaryColor
|
self.backgroundView.tintColor = params.primaryColor
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -711,7 +735,7 @@ public final class MessageInlineBlockBackgroundView: UIView {
|
|||||||
|
|
||||||
let itemSize = CGSize(width: placement.size / 3.0, height: placement.size / 3.0)
|
let itemSize = CGSize(width: placement.size / 3.0, height: placement.size / 3.0)
|
||||||
patternContentLayer.frame = CGRect(origin: CGPoint(x: size.width - placement.position.x / 3.0 - itemSize.width * 0.5, y: placement.position.y / 3.0 - itemSize.height * 0.5), size: itemSize)
|
patternContentLayer.frame = CGRect(origin: CGPoint(x: size.width - placement.position.x / 3.0 - itemSize.width * 0.5, y: placement.position.y / 3.0 - itemSize.height * 0.5), size: itemSize)
|
||||||
var alphaFraction = abs(placement.position.x) / 500.0
|
var alphaFraction = abs(placement.position.x) / min(500.0, size.width)
|
||||||
alphaFraction = min(1.0, max(0.0, alphaFraction))
|
alphaFraction = min(1.0, max(0.0, alphaFraction))
|
||||||
patternContentLayer.opacity = 0.3 * Float(1.0 - alphaFraction)
|
patternContentLayer.opacity = 0.3 * Float(1.0 - alphaFraction)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user