Skip to content

Commit

Permalink
Fix animations
Browse files Browse the repository at this point in the history
(cherry picked from commit 8a1d228)
  • Loading branch information
Isaac committed Jun 2, 2024
1 parent d1234b8 commit 6016f53
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,11 @@ public class ChatMessageAnimatedStickerItemNode: ChatMessageItemView {
}
}

let isPlaying = self.visibilityStatus == true && !self.forceStopAnimations
var isPlaying = self.visibilityStatus == true && !self.forceStopAnimations
if !item.controllerInteraction.canReadHistory {
isPlaying = false
}

if !isPlaying {
self.removeAdditionalAnimations()
self.removeEffectAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5936,6 +5936,9 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI
} else {
isPlaying = false
}
if !item.controllerInteraction.canReadHistory {
isPlaying = false
}

if !isPlaying {
self.removeEffectAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2156,6 +2156,9 @@ public class ChatMessageStickerItemNode: ChatMessageItemView {
} else {
isPlaying = false
}
if !item.controllerInteraction.canReadHistory {
isPlaying = false
}

if !isPlaying {
self.removeEffectAnimations()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -293,6 +293,7 @@ public final class ChatControllerInteraction: ChatControllerInteractionProtocol
public var recommendedChannelsOpenUp: Bool = false
public var enableFullTranslucency: Bool = true
public var chatIsRotated: Bool = true
public var canReadHistory: Bool = false

public init(
openMessage: @escaping (Message, OpenMessageParams) -> Bool,
Expand Down
7 changes: 7 additions & 0 deletions submodules/TelegramUI/Sources/ChatHistoryListNode.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2121,6 +2121,7 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
if let strongSelf = self {
if strongSelf.canReadHistoryValue != value {
strongSelf.canReadHistoryValue = value
strongSelf.controllerInteraction.canReadHistory = value
strongSelf.updateReadHistoryActions()

if strongSelf.canReadHistoryValue && !strongSelf.suspendReadingReactions && !strongSelf.messageIdsScheduledForMarkAsSeen.isEmpty {
Expand Down Expand Up @@ -2189,6 +2190,12 @@ public final class ChatHistoryListNodeImpl: ListView, ChatHistoryNode, ChatHisto
self.messageIdsWithReactionsScheduledForMarkAsSeen.removeAll()
self.context.account.viewTracker.updateMarkReactionsSeenForMessageIds(messageIds: messageIds)
}

if self.canReadHistoryValue {
self.forEachVisibleMessageItemNode { itemNode in
itemNode.unreadMessageRangeUpdated()
}
}
}

func takeGenericReactionEffect() -> String? {
Expand Down

0 comments on commit 6016f53

Please sign in to comment.