Various improvements

This commit is contained in:
Isaac 2024-06-07 16:07:36 +04:00
parent a2dfe5c75d
commit 53fe1718e9
3 changed files with 10 additions and 5 deletions

View File

@ -592,12 +592,14 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
} }
} }
var isPlaying = self.visibilityStatus == true && !self.forceStopAnimations let isPlaying = self.visibilityStatus == true && !self.forceStopAnimations
var canPlayEffects = isPlaying
if !item.controllerInteraction.canReadHistory { if !item.controllerInteraction.canReadHistory {
isPlaying = false canPlayEffects = false
} }
if !isPlaying { if !canPlayEffects {
self.removeAdditionalAnimations() self.removeAdditionalAnimations()
self.removeEffectAnimations() self.removeEffectAnimations()
} }
@ -630,7 +632,7 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
} }
} }
if isPlaying, let animationNode = self.animationNode as? AnimatedStickerNode { if canPlayEffects, let animationNode = self.animationNode as? AnimatedStickerNode {
var effectAlreadySeen = true var effectAlreadySeen = true
if item.message.flags.contains(.Incoming) { if item.message.flags.contains(.Incoming) {
if let unreadRange = item.controllerInteraction.unreadMessageRange[UnreadMessageRangeKey(peerId: item.message.id.peerId, namespace: item.message.id.namespace)] { if let unreadRange = item.controllerInteraction.unreadMessageRange[UnreadMessageRangeKey(peerId: item.message.id.peerId, namespace: item.message.id.namespace)] {

View File

@ -261,8 +261,8 @@ private func contentNodeMessagesAndClassesForItem(_ item: ChatMessageItem) -> ([
result.insert((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default)), at: 0) result.insert((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default)), at: 0)
} else { } else {
result.append((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default))) result.append((message, ChatMessageTextBubbleContentNode.self, itemAttributes, BubbleItemAttributes(isAttachment: false, neighborType: .text, neighborSpacing: isFile ? .condensed : .default)))
needReactions = false
} }
needReactions = false
} }
} else { } else {
if case .group = item.content { if case .group = item.content {

View File

@ -166,6 +166,9 @@ public class ChatMessageTextBubbleContentNode: ChatMessageBubbleContentNode {
guard let self else { guard let self else {
return return
} }
cancelParentGestures(view: self.view)
var mappedLocation: CGPoint? var mappedLocation: CGPoint?
if let location { if let location {
mappedLocation = self.textNode.textNode.layer.convert(location, to: self.layer) mappedLocation = self.textNode.textNode.layer.convert(location, to: self.layer)