Cleanup
This commit is contained in:
parent
0fd2765908
commit
3716f59e7d
3 changed files with 25 additions and 41 deletions
|
|
@ -278,12 +278,13 @@ public final class ChatMessageItemImpl: ChatMessageItem, CustomStringConvertible
|
|||
}
|
||||
|
||||
public var pinToEdgeWithInset: Bool {
|
||||
switch self.content {
|
||||
return false
|
||||
/*switch self.content {
|
||||
case let .message(message, _, _, _, _):
|
||||
return !message.effectivelyIncoming(self.context.account.peerId)
|
||||
case let .group(messages):
|
||||
return !messages[0].0.effectivelyIncoming(self.context.account.peerId)
|
||||
}
|
||||
}*/
|
||||
}
|
||||
|
||||
public init(presentationData: ChatPresentationData, context: AccountContext, chatLocation: ChatLocation, associatedData: ChatMessageItemAssociatedData, controllerInteraction: ChatControllerInteraction, content: ChatMessageItemContent, disableDate: Bool = false, additionalContent: ChatMessageItemAdditionalContent? = nil) {
|
||||
|
|
|
|||
|
|
@ -1098,7 +1098,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
)
|
||||
if self.textRevealLink == nil, self.textRevealAnimationState != nil {
|
||||
self.textRevealLink = SharedDisplayLinkDriver.shared.add { [weak self] _ in
|
||||
guard let self else {
|
||||
guard let self, let item = self.item else {
|
||||
return
|
||||
}
|
||||
guard let textRevealAnimationState = self.textRevealAnimationState else {
|
||||
|
|
@ -1112,7 +1112,7 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
|
||||
self.textNode.textNode.updateRevealCharacterCount(count: nil, animated: false)
|
||||
|
||||
if let statusNode = self.statusNode {
|
||||
if let statusNode = self.statusNode, !item.message.attributes.contains(where: { $0 is TypingDraftMessageAttribute }) {
|
||||
ContainedViewLayoutTransition.animated(duration: 0.2, curve: .easeInOut).updateAlpha(node: statusNode, alpha: 1.0)
|
||||
}
|
||||
|
||||
|
|
@ -1145,17 +1145,23 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
|
|||
|
||||
override public func animateInsertion(_ currentTimestamp: Double, duration: Double) {
|
||||
self.textNode.textNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
self.statusNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
if let statusNode = self.statusNode, statusNode.alpha != 0.0 {
|
||||
statusNode.layer.animateAlpha(from: 0.0, to: statusNode.alpha, duration: 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
override public func animateAdded(_ currentTimestamp: Double, duration: Double) {
|
||||
self.textNode.textNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
self.statusNode?.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
if let statusNode = self.statusNode, statusNode.alpha != 0.0 {
|
||||
statusNode.layer.animateAlpha(from: 0.0, to: statusNode.alpha, duration: 0.2)
|
||||
}
|
||||
}
|
||||
|
||||
override public func animateRemoved(_ currentTimestamp: Double, duration: Double) {
|
||||
self.textNode.textNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
self.statusNode?.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
if let statusNode = self.statusNode, statusNode.alpha != 0.0 {
|
||||
statusNode.layer.animateAlpha(from: statusNode.alpha, to: 0.0, duration: 0.2, removeOnCompletion: false)
|
||||
}
|
||||
}
|
||||
|
||||
override public func tapActionAtPoint(_ point: CGPoint, gesture: TapLongTapOrDoubleTapGesture, isEstimating: Bool) -> ChatMessageBubbleContentTapAction {
|
||||
|
|
|
|||
|
|
@ -2985,40 +2985,17 @@ final class TextContentItemLayer: SimpleLayer {
|
|||
self.addSublayer(snippetLayer)
|
||||
self.animatingSnippetLayers.append(snippetLayer)
|
||||
|
||||
if !"".isEmpty {
|
||||
//ComponentTransition(animation: .curve(duration: 0.3, curve: .easeInOut)).animateBlur(layer: snippetLayer, fromRadius: 10.0, toRadius: 0.0)
|
||||
|
||||
snippetLayer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
snippetLayer.animateScale(from: 0.1, to: 1.0, duration: 0.2, completion: { [weak self, weak snippetLayer] _ in
|
||||
guard let self, let snippetLayer else {
|
||||
return
|
||||
}
|
||||
snippetLayer.removeFromSuperlayer()
|
||||
self.animatingSnippetLayers.removeAll(where: { $0 === snippetLayer })
|
||||
self.updateRevealMask(animateNewSegments: false)
|
||||
})
|
||||
} else if "".isEmpty {
|
||||
ComponentTransition(animation: .curve(duration: 0.22, curve: .easeInOut)).animateBlur(layer: snippetLayer, fromRadius: 3.0, toRadius: 0.0)
|
||||
snippetLayer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
snippetLayer.animatePosition(from: CGPoint(x: 0.0, y: 6.0), to: CGPoint(), duration: 0.2, additive: true)
|
||||
snippetLayer.animateScale(from: 0.5, to: 1.0, duration: 0.2, completion: { [weak self, weak snippetLayer] _ in
|
||||
guard let self, let snippetLayer else {
|
||||
return
|
||||
}
|
||||
snippetLayer.removeFromSuperlayer()
|
||||
self.animatingSnippetLayers.removeAll(where: { $0 === snippetLayer })
|
||||
self.updateRevealMask(animateNewSegments: false)
|
||||
})
|
||||
} else {
|
||||
snippetLayer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2, completion: { [weak self, weak snippetLayer] _ in
|
||||
guard let self, let snippetLayer else {
|
||||
return
|
||||
}
|
||||
snippetLayer.removeFromSuperlayer()
|
||||
self.animatingSnippetLayers.removeAll(where: { $0 === snippetLayer })
|
||||
self.updateRevealMask(animateNewSegments: false)
|
||||
})
|
||||
}
|
||||
ComponentTransition(animation: .curve(duration: 0.22, curve: .easeInOut)).animateBlur(layer: snippetLayer, fromRadius: 2.0, toRadius: 0.0)
|
||||
snippetLayer.animateAlpha(from: 0.0, to: 1.0, duration: 0.2)
|
||||
snippetLayer.animatePosition(from: CGPoint(x: 0.0, y: 6.0), to: CGPoint(), duration: 0.2, additive: true)
|
||||
snippetLayer.animateScale(from: 0.5, to: 1.0, duration: 0.2, completion: { [weak self, weak snippetLayer] _ in
|
||||
guard let self, let snippetLayer else {
|
||||
return
|
||||
}
|
||||
snippetLayer.removeFromSuperlayer()
|
||||
self.animatingSnippetLayers.removeAll(where: { $0 === snippetLayer })
|
||||
self.updateRevealMask(animateNewSegments: false)
|
||||
})
|
||||
}
|
||||
globalCharIndex += lineCharCount
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue