mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-07-23 11:41:13 +00:00
Merge commit '5c9a7b80683cc06f087160715b2db0b881c52343'
This commit is contained in:
commit
c78e71991c
@ -71,6 +71,8 @@ public class ChatMessageBackground: ASDisplayNode {
|
||||
private let outlineImageNode: ASImageNode
|
||||
private weak var backgroundNode: WallpaperBackgroundNode?
|
||||
|
||||
public var backgroundFrame: CGRect = .zero
|
||||
|
||||
public var hasImage: Bool {
|
||||
self.imageNode.image != nil
|
||||
}
|
||||
|
@ -27,6 +27,7 @@ struct ChatMessageBubbleContentProperties {
|
||||
let forceFullCorners: Bool
|
||||
let forceAlignment: ChatMessageBubbleContentAlignment
|
||||
let shareButtonOffset: CGPoint?
|
||||
let hidesHeaders: Bool
|
||||
|
||||
init(
|
||||
hidesSimpleAuthorHeader: Bool,
|
||||
@ -34,7 +35,8 @@ struct ChatMessageBubbleContentProperties {
|
||||
hidesBackground: ChatMessageBubbleContentBackgroundHiding,
|
||||
forceFullCorners: Bool,
|
||||
forceAlignment: ChatMessageBubbleContentAlignment,
|
||||
shareButtonOffset: CGPoint? = nil
|
||||
shareButtonOffset: CGPoint? = nil,
|
||||
hidesHeaders: Bool = false
|
||||
) {
|
||||
self.hidesSimpleAuthorHeader = hidesSimpleAuthorHeader
|
||||
self.headerSpacing = headerSpacing
|
||||
@ -42,6 +44,7 @@ struct ChatMessageBubbleContentProperties {
|
||||
self.forceFullCorners = forceFullCorners
|
||||
self.forceAlignment = forceAlignment
|
||||
self.shareButtonOffset = shareButtonOffset
|
||||
self.hidesHeaders = hidesHeaders
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1527,6 +1527,7 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
}
|
||||
|
||||
var hidesHeaders = false
|
||||
var shareButtonOffset: CGPoint?
|
||||
var index = 0
|
||||
for (message, _, attributes, bubbleAttributes, prepareLayout) in contentPropertiesAndPrepareLayouts {
|
||||
@ -1586,6 +1587,9 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
if let offset = properties.shareButtonOffset {
|
||||
shareButtonOffset = offset
|
||||
}
|
||||
if properties.hidesHeaders {
|
||||
hidesHeaders = true
|
||||
}
|
||||
|
||||
contentPropertiesAndLayouts.append((unboundSize, properties, prepareContentPosition, bubbleAttributes, nodeLayout, needSeparateContainers && !bubbleAttributes.isAttachment ? message.stableId : nil, itemSelection))
|
||||
|
||||
@ -1626,7 +1630,9 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
var currentCredibilityIcon: EmojiStatusComponent.Content?
|
||||
|
||||
var initialDisplayHeader = true
|
||||
if let backgroundHiding = backgroundHiding, case .always = backgroundHiding {
|
||||
if hidesHeaders {
|
||||
initialDisplayHeader = false
|
||||
} else if let backgroundHiding = backgroundHiding, case .always = backgroundHiding {
|
||||
initialDisplayHeader = false
|
||||
} else {
|
||||
if inlineBotNameString == nil && (ignoreForward || firstMessage.forwardInfo == nil) && replyMessage == nil {
|
||||
@ -2378,7 +2384,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
mosaicStatusOrigin: mosaicStatusOrigin,
|
||||
mosaicStatusSizeAndApply: mosaicStatusSizeAndApply,
|
||||
needsShareButton: needsShareButton,
|
||||
shareButtonOffset: shareButtonOffset
|
||||
shareButtonOffset: shareButtonOffset,
|
||||
hidesHeaders: hidesHeaders
|
||||
)
|
||||
})
|
||||
}
|
||||
@ -2423,7 +2430,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
mosaicStatusOrigin: CGPoint?,
|
||||
mosaicStatusSizeAndApply: (CGSize, (ListViewItemUpdateAnimation) -> ChatMessageDateAndStatusNode)?,
|
||||
needsShareButton: Bool,
|
||||
shareButtonOffset: CGPoint?
|
||||
shareButtonOffset: CGPoint?,
|
||||
hidesHeaders: Bool
|
||||
) -> Void {
|
||||
guard let strongSelf = selfReference.value else {
|
||||
return
|
||||
@ -2479,6 +2487,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
strongSelf.backgroundType = backgroundType
|
||||
|
||||
strongSelf.backgroundNode.backgroundFrame = backgroundFrame
|
||||
|
||||
let isFailed = item.content.firstMessage.effectivelyFailed(timestamp: item.context.account.network.getApproximateRemoteTimestamp())
|
||||
if isFailed {
|
||||
let deliveryFailedNode: ChatMessageDeliveryFailedNode
|
||||
@ -2523,6 +2533,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
strongSelf.clippingNode.addSubnode(nameNode)
|
||||
nameNode.frame = nameNodeFrame
|
||||
|
||||
if animation.isAnimated {
|
||||
nameNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
} else {
|
||||
animation.animator.updateFrame(layer: nameNode.layer, frame: nameNodeFrame, completion: nil)
|
||||
}
|
||||
@ -2536,6 +2550,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
credibilityIconView.isUserInteractionEnabled = false
|
||||
strongSelf.credibilityIconView = credibilityIconView
|
||||
strongSelf.clippingNode.view.addSubview(credibilityIconView)
|
||||
|
||||
if animation.isAnimated {
|
||||
credibilityIconView.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
let credibilityIconComponent = EmojiStatusComponent(
|
||||
@ -2570,6 +2588,10 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
}
|
||||
strongSelf.clippingNode.addSubnode(adminBadgeNode)
|
||||
adminBadgeNode.frame = adminBadgeFrame
|
||||
|
||||
if animation.isAnimated {
|
||||
adminBadgeNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
}
|
||||
} else {
|
||||
//let previousAdminBadgeFrame = adminBadgeNode.frame
|
||||
animation.animator.updateFrame(layer: adminBadgeNode.layer, frame: adminBadgeFrame, completion: nil)
|
||||
@ -2579,12 +2601,33 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
strongSelf.adminBadgeNode = nil
|
||||
}
|
||||
} else {
|
||||
strongSelf.nameNode?.removeFromSupernode()
|
||||
strongSelf.nameNode = nil
|
||||
strongSelf.adminBadgeNode?.removeFromSupernode()
|
||||
strongSelf.adminBadgeNode = nil
|
||||
strongSelf.credibilityIconView?.removeFromSuperview()
|
||||
strongSelf.credibilityIconView = nil
|
||||
if animation.isAnimated {
|
||||
if let nameNode = strongSelf.nameNode {
|
||||
strongSelf.nameNode = nil
|
||||
nameNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak nameNode] _ in
|
||||
nameNode?.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
if let adminBadgeNode = strongSelf.adminBadgeNode {
|
||||
strongSelf.adminBadgeNode = nil
|
||||
adminBadgeNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak adminBadgeNode] _ in
|
||||
adminBadgeNode?.removeFromSupernode()
|
||||
})
|
||||
}
|
||||
if let credibilityIconView = strongSelf.credibilityIconView {
|
||||
strongSelf.credibilityIconView = nil
|
||||
credibilityIconView.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.1, removeOnCompletion: false, completion: { [weak credibilityIconView] _ in
|
||||
credibilityIconView?.removeFromSuperview()
|
||||
})
|
||||
}
|
||||
} else {
|
||||
strongSelf.nameNode?.removeFromSupernode()
|
||||
strongSelf.nameNode = nil
|
||||
strongSelf.adminBadgeNode?.removeFromSupernode()
|
||||
strongSelf.adminBadgeNode = nil
|
||||
strongSelf.credibilityIconView?.removeFromSuperview()
|
||||
strongSelf.credibilityIconView = nil
|
||||
}
|
||||
}
|
||||
|
||||
let beginAt = applyInfo.timestamp ?? CACurrentMediaTime()
|
||||
@ -2903,10 +2946,8 @@ class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewItemNode
|
||||
|
||||
let contentNode = strongSelf.contentNodes[contentNodeIndex]
|
||||
|
||||
var useContentOrigin = useContentOrigin
|
||||
if contentNode.disablesClipping {
|
||||
shouldClipOnTransitions = false
|
||||
useContentOrigin = false
|
||||
}
|
||||
|
||||
let contentNodeFrame = relativeFrame.offsetBy(dx: contentOrigin.x, dy: useContentOrigin ? contentOrigin.y : 0.0)
|
||||
|
@ -226,7 +226,7 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
let videoFrame = CGRect(origin: CGPoint(x: 1.0, y: 1.0), size: videoLayout.contentSize)
|
||||
|
||||
let contentProperties = ChatMessageBubbleContentProperties(hidesSimpleAuthorHeader: false, headerSpacing: 0.0, hidesBackground: .never, forceFullCorners: false, forceAlignment: .none, shareButtonOffset: isExpanded ? .zero : CGPoint(x: -16.0, y: -24.0))
|
||||
let contentProperties = ChatMessageBubbleContentProperties(hidesSimpleAuthorHeader: false, headerSpacing: 0.0, hidesBackground: .never, forceFullCorners: false, forceAlignment: .none, shareButtonOffset: isExpanded ? .zero : CGPoint(x: -16.0, y: -24.0), hidesHeaders: !isExpanded)
|
||||
|
||||
let width = videoFrame.width + 2.0
|
||||
|
||||
@ -282,16 +282,17 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
strongSelf.maskLayer.frame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: CGSize(width: 640.0, height: 640.0))
|
||||
strongSelf.backdropMaskLayer.frame = strongSelf.maskLayer.frame
|
||||
|
||||
|
||||
let bubbleSize = strongSelf.bubbleBackgroundNode?.backgroundFrame.size ?? finalSize
|
||||
|
||||
let radius: CGFloat = displaySize.width / 2.0
|
||||
let maskCornerRadius = isExpanded ? 1.0 : radius
|
||||
let maskFrame = CGRect(origin: CGPoint(x: isExpanded ? 1.0 : (incoming ? 7.0 : 1.0), y: isExpanded ? 0.0 : 1.0), size: isExpanded ? finalSize : CGSize(width: radius * 2.0, height: radius * 2.0))
|
||||
let maskFrame = CGRect(origin: CGPoint(x: isExpanded ? 1.0 : (incoming ? 7.0 : 1.0), y: isExpanded ? 0.0 : 1.0), size: isExpanded ? bubbleSize : CGSize(width: radius * 2.0, height: radius * 2.0))
|
||||
animation.animator.updateCornerRadius(layer: strongSelf.maskForeground, cornerRadius: maskCornerRadius, completion: nil)
|
||||
animation.animator.updateFrame(layer: strongSelf.maskForeground, frame: maskFrame, completion: nil)
|
||||
|
||||
let backdropMaskFrame = CGRect(origin: CGPoint(x: isExpanded ? (incoming ? 8.0 : 2.0) : (incoming ? 8.0 : 2.0), y: isExpanded ? 2.0 : 2.0), size: isExpanded ? CGSize(width: finalSize.width - 11.0, height: finalSize.height - 2.0) : CGSize(width: radius * 2.0, height: radius * 2.0))
|
||||
let backdropMaskFrame = CGRect(origin: CGPoint(x: isExpanded ? (incoming ? 8.0 : 2.0) : (incoming ? 8.0 : 2.0), y: isExpanded ? 2.0 : 2.0), size: isExpanded ? CGSize(width: bubbleSize.width - 8.0, height: bubbleSize.height - 3.0) : CGSize(width: radius * 2.0, height: radius * 2.0))
|
||||
|
||||
|
||||
let topLeftCornerRadius: CGFloat
|
||||
let topRightCornerRadius: CGFloat
|
||||
let bottomLeftCornerRadius: CGFloat
|
||||
|
Loading…
x
Reference in New Issue
Block a user