Various fixes

This commit is contained in:
Ilya Laktyushin
2022-10-22 15:43:53 +03:00
parent 93f9777b36
commit fc2a32678b
3 changed files with 14 additions and 8 deletions

View File

@@ -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 {

View File

@@ -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
}
}

View File

@@ -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
}