From 4a2e24843219bf9c52b15fe948ade230313abd89 Mon Sep 17 00:00:00 2001 From: Ilya Laktyushin Date: Wed, 8 Sep 2021 13:26:47 +0300 Subject: [PATCH] Fix instant video background not updating in theme change --- .../ChatMessageInteractiveInstantVideoNode.swift | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift index 0ff7f5f6b9..f21aa256bd 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift @@ -144,11 +144,8 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { var secretVideoPlaceholderBackgroundImage: UIImage? var updatedInfoBackgroundImage: UIImage? var updatedMuteIconImage: UIImage? - if item.presentationData.theme != currentItem?.presentationData.theme { - updatedInfoBackgroundImage = PresentationResourcesChat.chatInstantMessageInfoBackgroundImage(item.presentationData.theme.theme) - updatedMuteIconImage = PresentationResourcesChat.chatInstantMessageMuteIconImage(item.presentationData.theme.theme) - } + var updatedInstantVideoBackgroundImage: UIImage? let instantVideoBackgroundImage: UIImage? switch statusDisplayType { case .free: @@ -157,6 +154,12 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { instantVideoBackgroundImage = nil } + if item.presentationData.theme != currentItem?.presentationData.theme { + updatedInstantVideoBackgroundImage = instantVideoBackgroundImage + updatedInfoBackgroundImage = PresentationResourcesChat.chatInstantMessageInfoBackgroundImage(item.presentationData.theme.theme) + updatedMuteIconImage = PresentationResourcesChat.chatInstantMessageMuteIconImage(item.presentationData.theme.theme) + } + let theme = item.presentationData.theme let isSecretMedia = item.message.containsSecretMedia var secretProgressIcon: UIImage? @@ -333,6 +336,10 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { strongSelf.secretVideoPlaceholderBackground.image = secretVideoPlaceholderBackgroundImage } + if let updatedInstantVideoBackgroundImage = updatedInstantVideoBackgroundImage, let decoration = strongSelf.videoNode?.decoration as? ChatBubbleInstantVideoDecoration, let decorationBackgroundNode = decoration.backgroundNode as? ASImageNode { + decorationBackgroundNode.image = updatedInstantVideoBackgroundImage + } + strongSelf.media = updatedFile if let infoBackgroundImage = strongSelf.infoBackgroundNode.image, let muteImage = strongSelf.muteIconNode.image {