mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Various fixes
This commit is contained in:
parent
384eb313bc
commit
84949750cd
@ -221,8 +221,6 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let leftInset: CGFloat = 0.0
|
||||
let rightInset: CGFloat = 0.0
|
||||
|
||||
|
||||
|
||||
let (videoLayout, videoApply) = interactiveVideoLayout(ChatMessageBubbleContentItem(context: item.context, controllerInteraction: item.controllerInteraction, message: item.message, topMessage: item.message, read: item.read, chatLocation: item.chatLocation, presentationData: item.presentationData, associatedData: item.associatedData, attributes: item.attributes, isItemPinned: item.message.tags.contains(.pinned) && !isReplyThread, isItemEdited: false), constrainedSize.width - leftInset - rightInset - avatarInset, displaySize, maximumDisplaySize, isPlaying ? 1.0 : 0.0, .free, automaticDownload)
|
||||
|
||||
let videoFrame = CGRect(origin: CGPoint(x: 1.0, y: 1.0), size: videoLayout.contentSize)
|
||||
@ -230,9 +228,6 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
let contentProperties = ChatMessageBubbleContentProperties(hidesSimpleAuthorHeader: false, headerSpacing: 0.0, hidesBackground: .never, forceFullCorners: false, forceAlignment: .none, shareButtonOffset: isExpanded ? .zero : CGPoint(x: -16.0, y: -24.0))
|
||||
|
||||
let width = videoFrame.width + 2.0
|
||||
// if isExpanded {
|
||||
// width = normalDisplaySize.width + 32.0
|
||||
// }
|
||||
|
||||
return (contentProperties, nil, width, { constrainedSize, position in
|
||||
var refinedWidth = videoFrame.width + 2.0
|
||||
@ -240,7 +235,6 @@ class ChatMessageInstantVideoBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
|
||||
if isExpanded || !didSetupFileNode {
|
||||
(refinedWidth, finishLayout) = refineLayout(CGSize(width: constrainedSize.width - layoutConstants.file.bubbleInsets.left - layoutConstants.file.bubbleInsets.right, height: constrainedSize.height))
|
||||
// refinedWidth = refinedWidth//max(refinedWidth, normalDisplaySize.width)
|
||||
refinedWidth += layoutConstants.file.bubbleInsets.left + layoutConstants.file.bubbleInsets.right
|
||||
}
|
||||
|
||||
|
@ -86,7 +86,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
private var playerStatus: MediaPlayerStatus? {
|
||||
didSet {
|
||||
if self.playerStatus != oldValue {
|
||||
self.updateStatus()
|
||||
self.updateStatus(animator: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -465,9 +465,11 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
var previousVideoNode: UniversalVideoNode?
|
||||
var updatedPlayerStatusSignal: Signal<MediaPlayerStatus?, NoError>?
|
||||
if let telegramFile = updatedFile {
|
||||
if updatedMedia {
|
||||
previousVideoNode = strongSelf.videoNode
|
||||
if let durationBlurColor = durationBlurColor {
|
||||
if let durationBackgroundNode = strongSelf.durationBackgroundNode {
|
||||
durationBackgroundNode.updateColor(color: durationBlurColor.0, enableBlur: durationBlurColor.1, transition: .immediate)
|
||||
@ -518,7 +520,11 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
}), content: NativeVideoContent(id: .message(item.message.stableId, telegramFile.fileId), fileReference: .message(message: MessageReference(item.message), media: telegramFile), streamVideo: streamVideo ? .conservative : .none, enableSound: false, fetchAutomatically: false, captureProtected: item.message.isCopyProtected()), priority: .embedded, autoplay: true)
|
||||
let previousVideoNode = strongSelf.videoNode
|
||||
if let previousVideoNode = previousVideoNode {
|
||||
videoNode.bounds = previousVideoNode.bounds
|
||||
videoNode.position = previousVideoNode.position
|
||||
videoNode.transform = previousVideoNode.transform
|
||||
}
|
||||
strongSelf.videoNode = videoNode
|
||||
strongSelf.insertSubnode(videoNode, belowSubnode: previousVideoNode ?? strongSelf.dateAndStatusNode)
|
||||
videoNode.canAttachContent = strongSelf.shouldAcquireVideoContext
|
||||
@ -548,7 +554,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
|> deliverOnMainQueue).start(next: { status in
|
||||
if let strongSelf = self {
|
||||
strongSelf.status = status
|
||||
strongSelf.updateStatus()
|
||||
strongSelf.updateStatus(animator: nil)
|
||||
}
|
||||
}))
|
||||
}
|
||||
@ -658,12 +664,17 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
|
||||
if let videoNode = strongSelf.videoNode {
|
||||
videoNode.bounds = CGRect(origin: CGPoint(), size: videoFrame.size)
|
||||
if imageScale != strongSelf.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)
|
||||
|
||||
if let previousVideoNode = previousVideoNode {
|
||||
animation.animator.updateScale(layer: previousVideoNode.layer, scale: imageScale, completion: nil)
|
||||
animation.animator.updatePosition(layer: previousVideoNode.layer, position: displayVideoFrame.center, completion: nil)
|
||||
}
|
||||
}
|
||||
animation.animator.updateFrame(layer: strongSelf.secretVideoPlaceholderBackground.layer, frame: displayVideoFrame, completion: nil)
|
||||
|
||||
@ -677,7 +688,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
let applySecretPlaceholder = makeSecretPlaceholderLayout(arguments)
|
||||
applySecretPlaceholder()
|
||||
|
||||
strongSelf.updateStatus()
|
||||
strongSelf.updateStatus(animator: animation.animator)
|
||||
|
||||
if let telegramFile = updatedFile, previousAutomaticDownload != automaticDownload, automaticDownload {
|
||||
strongSelf.fetchDisposable.set(messageMediaFileInteractiveFetched(context: item.context, message: item.message, file: telegramFile, userInitiated: false).start())
|
||||
@ -698,7 +709,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
}
|
||||
|
||||
private func updateStatus() {
|
||||
private func updateStatus(animator: ControlledTransitionAnimator? = nil) {
|
||||
guard let item = self.item, let status = self.status, let videoFrame = self.videoFrame else {
|
||||
return
|
||||
}
|
||||
@ -800,8 +811,17 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
let statusFrame = CGRect(origin: CGPoint(x: videoFrame.origin.x + floorToScreenPixels((videoFrame.size.width - 50.0) / 2.0), y: videoFrame.origin.y + floorToScreenPixels((videoFrame.size.height - 50.0) / 2.0)), size: CGSize(width: 50.0, height: 50.0))
|
||||
if let animator = animator {
|
||||
if let statusNode = self.statusNode {
|
||||
animator.updateFrame(layer: statusNode.layer, frame: statusFrame, completion: nil)
|
||||
}
|
||||
if let disappearingStatusNode = self.disappearingStatusNode {
|
||||
animator.updateFrame(layer: disappearingStatusNode.layer, frame: statusFrame, completion: nil)
|
||||
}
|
||||
} else {
|
||||
self.statusNode?.frame = statusFrame
|
||||
self.disappearingStatusNode?.frame = statusFrame
|
||||
}
|
||||
|
||||
var state: RadialStatusNodeState
|
||||
switch status.mediaStatus {
|
||||
@ -1132,7 +1152,7 @@ class ChatMessageInteractiveInstantVideoNode: ASDisplayNode {
|
||||
|
||||
var updateTranscribeExpanded: ((AudioTranscriptionButtonComponent.TranscriptionState, TranscribedText?) -> Void)?
|
||||
private func transcribe() {
|
||||
guard let context = self.item?.context, let message = self.item?.message else {
|
||||
guard let context = self.item?.context, let message = self.item?.message, self.statusNode == nil else {
|
||||
return
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user