diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift index b477898f58..e006fdbcc6 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveFileNode.swift @@ -1219,7 +1219,13 @@ final class ChatMessageInteractiveFileNode: ASDisplayNode { streamingStatusNode.frame = streamingCacheStatusFrame } - if let updatedStatusSignal = updatedStatusSignal { + if var updatedStatusSignal = updatedStatusSignal { + if strongSelf.file?.isInstantVideo == true { + updatedStatusSignal = updatedStatusSignal + |> mapToThrottled { next -> Signal<(FileMediaResourceStatus, MediaResourceStatus?), NoError> in + return .single(next) |> then(.complete() |> delay(0.1, queue: Queue.concurrentDefaultQueue())) + } + } strongSelf.statusDisposable.set((updatedStatusSignal |> deliverOnMainQueue).start(next: { [weak strongSelf] status, actualFetchStatus in displayLinkDispatcher.dispatch { if let strongSelf = strongSelf { diff --git a/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift b/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift index 5f6ceae13f..98a8ac1623 100644 --- a/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift +++ b/submodules/TelegramUI/Sources/ChatMessageInteractiveInstantVideoNode.swift @@ -626,7 +626,6 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { if let durationNode = strongSelf.durationNode { var durationFrame = CGRect(origin: CGPoint(x: displayVideoFrame.midX - 56.0 - 25.0 * scaleProgress, y: displayVideoFrame.maxY - 18.0), size: CGSize(width: 1.0, height: 1.0)) - animation.animator.updateFrame(layer: durationNode.layer, frame: durationFrame, completion: nil) durationNode.isSeen = !notConsumed let size = durationNode.size @@ -638,6 +637,8 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { } animation.animator.updateFrame(layer: durationNode.layer, frame: durationFrame, completion: nil) animation.animator.updateFrame(layer: durationBackgroundNode.layer, frame: CGRect(origin: CGPoint(x: durationNode.frame.maxX - size.width, y: durationNode.frame.minY), size: size), completion: nil) + } else { + animation.animator.updateFrame(layer: durationNode.layer, frame: durationFrame, completion: nil) } } @@ -664,10 +665,10 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { if let videoNode = strongSelf.videoNode { videoNode.bounds = CGRect(origin: CGPoint(), size: videoFrame.size) - - strongSelf.imageScale = imageScale - animation.animator.updateScale(layer: videoNode.layer, scale: imageScale, completion: nil) - + if strongSelf.imageScale != imageScale { + strongSelf.imageScale = imageScale + animation.animator.updateScale(layer: videoNode.layer, scale: imageScale, completion: nil) + } animation.animator.updatePosition(layer: videoNode.layer, position: displayVideoFrame.center, completion: nil) videoNode.updateLayout(size: arguments.boundingSize, transition: animation.transition) @@ -1370,4 +1371,3 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode { self.customIsHidden = false } } - diff --git a/submodules/TelegramUI/Sources/ChatMessageItemView.swift b/submodules/TelegramUI/Sources/ChatMessageItemView.swift index ce3785ecc7..514c8ebdba 100644 --- a/submodules/TelegramUI/Sources/ChatMessageItemView.swift +++ b/submodules/TelegramUI/Sources/ChatMessageItemView.swift @@ -126,7 +126,7 @@ func chatMessageItemLayoutConstants(_ constants: (ChatMessageItemLayoutConstants let textInset: CGFloat = min(maxInset, ceil(maxInset * radiusTransition + minInset * (1.0 - radiusTransition))) result.text.bubbleInsets.left = textInset result.text.bubbleInsets.right = textInset - result.instantVideo.dimensions = min(params.width, params.availableHeight) > 320.0 ? constants.1.instantVideo.dimensions : constants.0.instantVideo.dimensions + result.instantVideo.dimensions = params.width > 320.0 ? constants.1.instantVideo.dimensions : constants.0.instantVideo.dimensions return result }