Fix gradient background animation

This commit is contained in:
Ali
2021-06-11 01:28:48 +04:00
parent dd768dfdeb
commit d0d06bc650
14 changed files with 240 additions and 35 deletions

View File

@@ -245,11 +245,22 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.titleAccessoryPanelContainer.clipsToBounds = true
self.inputContextPanelContainer = ChatControllerTitlePanelNodeContainer()
self.historyNode = ChatHistoryListNode(context: context, chatLocation: chatLocation, chatLocationContextHolder: chatLocationContextHolder, tagMask: nil, subject: subject, controllerInteraction: controllerInteraction, selectedMessages: self.selectedMessagesPromise.get())
var getMessageTransitionNode: (() -> ChatMessageTransitionNode?)?
self.historyNode = ChatHistoryListNode(context: context, chatLocation: chatLocation, chatLocationContextHolder: chatLocationContextHolder, tagMask: nil, subject: subject, controllerInteraction: controllerInteraction, selectedMessages: self.selectedMessagesPromise.get(), messageTransitionNode: {
return getMessageTransitionNode?()
})
self.historyNode.rotated = true
self.historyNodeContainer = ASDisplayNode()
self.historyNodeContainer.addSubnode(self.historyNode)
var getContentAreaInScreenSpaceImpl: (() -> CGRect)?
var onTransitionEventImpl: ((ContainedViewLayoutTransition) -> Void)?
self.messageTransitionNode = ChatMessageTransitionNode(listNode: self.historyNode, getContentAreaInScreenSpace: {
return getContentAreaInScreenSpaceImpl?() ?? CGRect()
}, onTransitionEvent: { transition in
onTransitionEventImpl?(transition)
})
self.reactionContainerNode = ReactionSelectionParentNode(account: context.account, theme: chatPresentationInterfaceState.theme)
@@ -271,14 +282,6 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
self.navigateButtons = ChatHistoryNavigationButtons(theme: self.chatPresentationInterfaceState.theme, dateTimeFormat: self.chatPresentationInterfaceState.dateTimeFormat)
self.navigateButtons.accessibilityElementsHidden = true
var getContentAreaInScreenSpaceImpl: (() -> CGRect)?
var onTransitionEventImpl: ((ContainedViewLayoutTransition) -> Void)?
self.messageTransitionNode = ChatMessageTransitionNode(listNode: self.historyNode, getContentAreaInScreenSpace: {
return getContentAreaInScreenSpaceImpl?() ?? CGRect()
}, onTransitionEvent: { transition in
onTransitionEventImpl?(transition)
})
super.init()
@@ -299,6 +302,10 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
}
strongSelf.backgroundNode.animateEvent(transition: transition)
}
getMessageTransitionNode = { [weak self] in
return self?.messageTransitionNode
}
self.controller?.presentationContext.topLevelSubview = { [weak self] in
guard let strongSelf = self else {
@@ -2300,7 +2307,7 @@ class ChatControllerNode: ASDisplayNode, UIScrollViewDelegate {
webpage = self.chatPresentationInterfaceState.urlPreview?.1
}
#if DEBUG
webpage = nil
//webpage = nil
#endif
messages.append(.message(text: text.string, attributes: attributes, mediaReference: webpage.flatMap(AnyMediaReference.standalone), replyToMessageId: self.chatPresentationInterfaceState.interfaceState.replyMessageId, localGroupingKey: nil, correlationId: nil))
}