Animation experiment

This commit is contained in:
Ali
2021-04-13 21:06:58 +04:00
parent 2360ed2868
commit d26313f99a
41 changed files with 682 additions and 1687 deletions

View File

@@ -1780,7 +1780,6 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
if let historyView = strongSelf.historyView {
if historyView.filteredEntries.isEmpty {
if let firstEntry = historyView.originalView.entries.first {
var isPeerJoined = false
var emptyType = ChatHistoryNodeLoadState.EmptyType.generic
for media in firstEntry.message.media {
if let action = media as? TelegramMediaAction {
@@ -1893,6 +1892,28 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
} else if transition.scrolledToSomeIndex {
self?.scrolledToSomeIndex?()
}
if let currentSendAnimationCorrelationId = strongSelf.currentSendAnimationCorrelationId {
var foundItemNode: ChatMessageItemView?
strongSelf.forEachItemNode { itemNode in
if let itemNode = itemNode as? ChatMessageItemView, let item = itemNode.item {
for (message, _) in item.content {
for attribute in message.attributes {
if let attribute = attribute as? OutgoingMessageInfoAttribute {
if attribute.correlationId == currentSendAnimationCorrelationId {
foundItemNode = itemNode
}
}
}
}
}
}
if let foundItemNode = foundItemNode {
strongSelf.currentSendAnimationCorrelationId = nil
strongSelf.animationCorrelationMessageFound?(foundItemNode, currentSendAnimationCorrelationId)
}
}
strongSelf.hasActiveTransition = false
strongSelf.dequeueHistoryViewTransitions()
@@ -2245,4 +2266,11 @@ public final class ChatHistoryListNode: ListView, ChatHistoryNode {
})
self.selectionScrollDisplayLink?.isPaused = false
}
private var currentSendAnimationCorrelationId: Int64?
func setCurrentSendAnimationCorrelationId(_ value: Int64?) {
self.currentSendAnimationCorrelationId = value
}
var animationCorrelationMessageFound: ((ChatMessageItemView, Int64?) -> Void)?
}