Pre-release fixes

This commit is contained in:
Ali 2021-07-27 00:49:16 +02:00
parent e0d4cb86fe
commit 5ae11cecd2
10 changed files with 62 additions and 49 deletions

View File

@ -480,6 +480,7 @@ final class NavigationContainer: ASDisplayNode, UIGestureRecognizerDelegate {
toValue.value.setIgnoreAppearanceMethodInvocations(true) toValue.value.setIgnoreAppearanceMethodInvocations(true)
self.addSubnode(toValue.value.displayNode) self.addSubnode(toValue.value.displayNode)
toValue.value.setIgnoreAppearanceMethodInvocations(false) toValue.value.setIgnoreAppearanceMethodInvocations(false)
toValue.value.displayNode.recursivelyEnsureDisplaySynchronously(true)
toValue.value.viewDidAppear(false) toValue.value.viewDidAppear(false)
} }
} }

View File

@ -53,7 +53,7 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
} }
} }
private var imageNode: ASImageNode? private(set) var imageNode: ASImageNode?
private let imageRippleNode: ASImageNode private let imageRippleNode: ASImageNode
private var _image: UIImage? private var _image: UIImage?
@ -226,7 +226,7 @@ private final class NavigationButtonItemNode: ImmediateTextNode {
} else if let imageNode = self.imageNode { } else if let imageNode = self.imageNode {
let nodeSize = imageNode.image?.size ?? CGSize() let nodeSize = imageNode.image?.size ?? CGSize()
let size = CGSize(width: max(nodeSize.width, superSize.width), height: max(44.0, max(nodeSize.height, superSize.height))) let size = CGSize(width: max(nodeSize.width, superSize.width), height: max(44.0, max(nodeSize.height, superSize.height)))
let imageFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - nodeSize.width) / 2.0) + 5.0, y: floorToScreenPixels((size.height - nodeSize.height) / 2.0)), size: nodeSize) let imageFrame = CGRect(origin: CGPoint(x: floorToScreenPixels((size.width - nodeSize.width) / 2.0), y: floorToScreenPixels((size.height - nodeSize.height) / 2.0)), size: nodeSize)
imageNode.frame = imageFrame imageNode.frame = imageFrame
self.imageRippleNode.frame = imageFrame self.imageRippleNode.frame = imageFrame
return size return size
@ -462,24 +462,30 @@ public final class NavigationButtonNode: ASDisplayNode {
public func updateLayout(constrainedSize: CGSize, isLandscape: Bool) -> CGSize { public func updateLayout(constrainedSize: CGSize, isLandscape: Bool) -> CGSize {
var nodeOrigin = CGPoint() var nodeOrigin = CGPoint()
var totalSize = CGSize() var totalHeight: CGFloat = 0.0
for node in self.nodes { for i in 0 ..< self.nodes.count {
if !totalSize.width.isZero { if i != 0 {
totalSize.width += 16.0 nodeOrigin.x += 10.0
nodeOrigin.x += 16.0
} }
let node = self.nodes[i]
var nodeSize = node.updateLayout(constrainedSize) var nodeSize = node.updateLayout(constrainedSize)
nodeSize.width = ceil(nodeSize.width) nodeSize.width = ceil(nodeSize.width)
nodeSize.height = ceil(nodeSize.height) nodeSize.height = ceil(nodeSize.height)
totalSize.width += nodeSize.width totalHeight = max(totalHeight, nodeSize.height)
totalSize.height = max(totalSize.height, nodeSize.height) node.frame = CGRect(origin: CGPoint(x: nodeOrigin.x, y: floor((totalHeight - nodeSize.height) / 2.0)), size: nodeSize)
node.frame = CGRect(origin: CGPoint(x: nodeOrigin.x, y: floor((totalSize.height - nodeSize.height) / 2.0)), size: nodeSize)
nodeOrigin.x += node.bounds.width nodeOrigin.x += node.bounds.width
if isLandscape { if isLandscape {
nodeOrigin.x += 16.0 nodeOrigin.x += 16.0
} }
if node.node == nil && node.imageNode != nil && i == self.nodes.count - 1 {
nodeOrigin.x -= 5.0
}
} }
return totalSize return CGSize(width: nodeOrigin.x, height: totalHeight)
} }
func internalHitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? { func internalHitTest(_ point: CGPoint, with event: UIEvent?) -> UIView? {

View File

@ -144,7 +144,7 @@ private func galleryMessageCaptionText(_ message: Message) -> String {
return message.text return message.text
} }
public func galleryItemForEntry(context: AccountContext, presentationData: PresentationData, entry: MessageHistoryEntry, isCentral: Bool = false, streamVideos: Bool, loopVideos: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, isSecret: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackRate: Double? = nil, displayInfoOnTop: Bool = false, configuration: GalleryConfiguration? = nil, tempFilePath: String? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, openActionOptions: @escaping (GalleryControllerInteractionTapAction, Message) -> Void = { _, _ in }, storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void = { _, _, _ in }, present: @escaping (ViewController, Any?) -> Void) -> GalleryItem? { public func galleryItemForEntry(context: AccountContext, presentationData: PresentationData, entry: MessageHistoryEntry, isCentral: Bool = false, streamVideos: Bool, loopVideos: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, isSecret: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackRate: @escaping () -> Double?, displayInfoOnTop: Bool = false, configuration: GalleryConfiguration? = nil, tempFilePath: String? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void = { _ in }, openActionOptions: @escaping (GalleryControllerInteractionTapAction, Message) -> Void = { _, _ in }, storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void = { _, _, _ in }, present: @escaping (ViewController, Any?) -> Void) -> GalleryItem? {
let message = entry.message let message = entry.message
let location = entry.location let location = entry.location
if let (media, mediaImage) = mediaForMessage(message: message) { if let (media, mediaImage) = mediaForMessage(message: message) {
@ -538,7 +538,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == strongSelf.centralEntryStableId { if entry.message.stableId == strongSelf.centralEntryStableId {
isCentral = true isCentral = true
} }
if let item = galleryItemForEntry(context: context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: streamSingleVideo, fromPlayingVideo: isCentral && fromPlayingVideo, landscape: isCentral && landscape, timecode: isCentral ? timecode : nil, playbackRate: playbackRate, displayInfoOnTop: displayInfoOnTop, configuration: configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in if let item = galleryItemForEntry(context: context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: streamSingleVideo, fromPlayingVideo: isCentral && fromPlayingVideo, landscape: isCentral && landscape, timecode: isCentral ? timecode : nil, playbackRate: { return self?.playbackRate }, displayInfoOnTop: displayInfoOnTop, configuration: configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in
if let strongSelf = self { if let strongSelf = self {
strongSelf.presentInGlobalOverlay(c, with: a) strongSelf.presentInGlobalOverlay(c, with: a)
} }
@ -1102,7 +1102,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == self.centralEntryStableId { if entry.message.stableId == self.centralEntryStableId {
isCentral = true isCentral = true
} }
if let item = galleryItemForEntry(context: self.context, presentationData: self.presentationData, entry: entry, streamVideos: self.streamVideos, fromPlayingVideo: isCentral && self.fromPlayingVideo, landscape: isCentral && self.landscape, timecode: isCentral ? self.timecode : nil, playbackRate: self.playbackRate, displayInfoOnTop: displayInfoOnTop, configuration: self.configuration, performAction: self.performAction, openActionOptions: self.openActionOptions, storeMediaPlaybackState: self.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in if let item = galleryItemForEntry(context: self.context, presentationData: self.presentationData, entry: entry, streamVideos: self.streamVideos, fromPlayingVideo: isCentral && self.fromPlayingVideo, landscape: isCentral && self.landscape, timecode: isCentral ? self.timecode : nil, playbackRate: { [weak self] in return self?.playbackRate }, displayInfoOnTop: displayInfoOnTop, configuration: self.configuration, performAction: self.performAction, openActionOptions: self.openActionOptions, storeMediaPlaybackState: self.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in
if let strongSelf = self { if let strongSelf = self {
strongSelf.presentInGlobalOverlay(c, with: a) strongSelf.presentInGlobalOverlay(c, with: a)
} }
@ -1182,7 +1182,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == strongSelf.centralEntryStableId { if entry.message.stableId == strongSelf.centralEntryStableId {
isCentral = true isCentral = true
} }
if let item = galleryItemForEntry(context: strongSelf.context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: false, fromPlayingVideo: isCentral && strongSelf.fromPlayingVideo, landscape: isCentral && strongSelf.landscape, timecode: isCentral ? strongSelf.timecode : nil, displayInfoOnTop: displayInfoOnTop, configuration: strongSelf.configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in if let item = galleryItemForEntry(context: strongSelf.context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: false, fromPlayingVideo: isCentral && strongSelf.fromPlayingVideo, landscape: isCentral && strongSelf.landscape, timecode: isCentral ? strongSelf.timecode : nil, playbackRate: { return self?.playbackRate }, displayInfoOnTop: displayInfoOnTop, configuration: strongSelf.configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in
if let strongSelf = self { if let strongSelf = self {
strongSelf.presentInGlobalOverlay(c, with: a) strongSelf.presentInGlobalOverlay(c, with: a)
} }
@ -1234,7 +1234,7 @@ public class GalleryController: ViewController, StandalonePresentableController
if entry.message.stableId == strongSelf.centralEntryStableId { if entry.message.stableId == strongSelf.centralEntryStableId {
isCentral = true isCentral = true
} }
if let item = galleryItemForEntry(context: strongSelf.context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: false, fromPlayingVideo: isCentral && strongSelf.fromPlayingVideo, landscape: isCentral && strongSelf.landscape, timecode: isCentral ? strongSelf.timecode : nil, displayInfoOnTop: displayInfoOnTop, configuration: strongSelf.configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in if let item = galleryItemForEntry(context: strongSelf.context, presentationData: strongSelf.presentationData, entry: entry, isCentral: isCentral, streamVideos: false, fromPlayingVideo: isCentral && strongSelf.fromPlayingVideo, landscape: isCentral && strongSelf.landscape, timecode: isCentral ? strongSelf.timecode : nil, playbackRate: { return self?.playbackRate }, displayInfoOnTop: displayInfoOnTop, configuration: strongSelf.configuration, performAction: strongSelf.performAction, openActionOptions: strongSelf.openActionOptions, storeMediaPlaybackState: strongSelf.actionInteraction?.storeMediaPlaybackState ?? { _, _, _ in }, present: { [weak self] c, a in
if let strongSelf = self { if let strongSelf = self {
strongSelf.presentInGlobalOverlay(c, with: a) strongSelf.presentInGlobalOverlay(c, with: a)
} }

View File

@ -44,7 +44,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
let isSecret: Bool let isSecret: Bool
let landscape: Bool let landscape: Bool
let timecode: Double? let timecode: Double?
let playbackRate: Double? let playbackRate: () -> Double?
let configuration: GalleryConfiguration? let configuration: GalleryConfiguration?
let playbackCompleted: () -> Void let playbackCompleted: () -> Void
let performAction: (GalleryControllerInteractionTapAction) -> Void let performAction: (GalleryControllerInteractionTapAction) -> Void
@ -52,7 +52,7 @@ public class UniversalVideoGalleryItem: GalleryItem {
let storeMediaPlaybackState: (MessageId, Double?, Double) -> Void let storeMediaPlaybackState: (MessageId, Double?, Double) -> Void
let present: (ViewController, Any?) -> Void let present: (ViewController, Any?) -> Void
public init(context: AccountContext, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, displayInfoOnTop: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, isSecret: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackRate: Double? = nil, configuration: GalleryConfiguration? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction, Message) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void, present: @escaping (ViewController, Any?) -> Void) { public init(context: AccountContext, presentationData: PresentationData, content: UniversalVideoContent, originData: GalleryItemOriginData?, indexData: GalleryItemIndexData?, contentInfo: UniversalVideoGalleryItemContentInfo?, caption: NSAttributedString, credit: NSAttributedString? = nil, displayInfoOnTop: Bool = false, hideControls: Bool = false, fromPlayingVideo: Bool = false, isSecret: Bool = false, landscape: Bool = false, timecode: Double? = nil, playbackRate: @escaping () -> Double?, configuration: GalleryConfiguration? = nil, playbackCompleted: @escaping () -> Void = {}, performAction: @escaping (GalleryControllerInteractionTapAction) -> Void, openActionOptions: @escaping (GalleryControllerInteractionTapAction, Message) -> Void, storeMediaPlaybackState: @escaping (MessageId, Double?, Double) -> Void, present: @escaping (ViewController, Any?) -> Void) {
self.context = context self.context = context
self.presentationData = presentationData self.presentationData = presentationData
self.content = content self.content = content
@ -364,13 +364,15 @@ private final class MoreHeaderButton: HighlightableButtonNode {
strongSelf.contextAction?(strongSelf.containerNode, gesture) strongSelf.contextAction?(strongSelf.containerNode, gesture)
} }
self.containerNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: wide ? 32.0 : 22.0, height: 22.0)) self.containerNode.frame = CGRect(origin: CGPoint(), size: CGSize(width: 26.0, height: 44.0))
self.referenceNode.frame = self.containerNode.bounds self.referenceNode.frame = self.containerNode.bounds
self.iconNode.image = optionsCircleImage(dark: false) self.iconNode.image = optionsCircleImage(dark: false)
if let image = self.iconNode.image { if let image = self.iconNode.image {
self.iconNode.frame = CGRect(origin: CGPoint(x: floor((self.containerNode.bounds.width - image.size.width) / 2.0), y: floor((self.containerNode.bounds.height - image.size.height) / 2.0)), size: image.size) self.iconNode.frame = CGRect(origin: CGPoint(x: floor((self.containerNode.bounds.width - image.size.width) / 2.0), y: floor((self.containerNode.bounds.height - image.size.height) / 2.0)), size: image.size)
} }
self.hitTestSlop = UIEdgeInsets(top: 0.0, left: -4.0, bottom: 0.0, right: -4.0)
} }
private var content: Content? private var content: Content?
@ -380,7 +382,8 @@ private final class MoreHeaderButton: HighlightableButtonNode {
let animationNode = AnimationNode(animation: "anim_profilemore", colors: ["Point 2.Group 1.Fill 1": iconColor, let animationNode = AnimationNode(animation: "anim_profilemore", colors: ["Point 2.Group 1.Fill 1": iconColor,
"Point 3.Group 1.Fill 1": iconColor, "Point 3.Group 1.Fill 1": iconColor,
"Point 1.Group 1.Fill 1": iconColor], scale: 1.0) "Point 1.Group 1.Fill 1": iconColor], scale: 1.0)
animationNode.frame = self.containerNode.bounds let animationSize = CGSize(width: 22.0, height: 22.0)
animationNode.frame = CGRect(origin: CGPoint(x: floor((self.containerNode.bounds.width - animationSize.width) / 2.0), y: floor((self.containerNode.bounds.height - animationSize.height) / 2.0)), size: animationSize)
self.addSubnode(animationNode) self.addSubnode(animationNode)
self.animationNode = animationNode self.animationNode = animationNode
} }
@ -423,10 +426,18 @@ private final class MoreHeaderButton: HighlightableButtonNode {
self.content = content self.content = content
switch content { switch content {
case let .image(image): case let .image(image):
if let image = image {
self.iconNode.frame = CGRect(origin: CGPoint(x: floor((self.containerNode.bounds.width - image.size.width) / 2.0), y: floor((self.containerNode.bounds.height - image.size.height) / 2.0)), size: image.size)
}
self.iconNode.image = image self.iconNode.image = image
self.iconNode.isHidden = false self.iconNode.isHidden = false
self.animationNode?.isHidden = true self.animationNode?.isHidden = true
case let .more(image): case let .more(image):
if let image = image {
self.iconNode.frame = CGRect(origin: CGPoint(x: floor((self.containerNode.bounds.width - image.size.width) / 2.0), y: floor((self.containerNode.bounds.height - image.size.height) / 2.0)), size: image.size)
}
self.iconNode.image = image self.iconNode.image = image
self.iconNode.isHidden = false self.iconNode.isHidden = false
self.animationNode?.isHidden = false self.animationNode?.isHidden = false
@ -440,7 +451,7 @@ private final class MoreHeaderButton: HighlightableButtonNode {
} }
override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize { override func calculateSizeThatFits(_ constrainedSize: CGSize) -> CGSize {
return CGSize(width: wide ? 32.0 : 22.0, height: 22.0) return CGSize(width: wide ? 32.0 : 22.0, height: 44.0)
} }
func onLayout() { func onLayout() {
@ -847,7 +858,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
} }
if let playbackRate = strongSelf.playbackRate { if let playbackRate = strongSelf.playbackRate {
videoNode.setBaseRate(playbackRate) strongSelf.videoNode?.setBaseRate(playbackRate)
} }
} }
} }
@ -1172,9 +1183,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
self.item = item self.item = item
if let _ = item.content as? NativeVideoContent { if let _ = item.content as? NativeVideoContent {
self.playbackRate = item.playbackRate self.playbackRate = item.playbackRate()
} else if let _ = item.content as? WebEmbedVideoContent { } else if let _ = item.content as? WebEmbedVideoContent {
self.playbackRate = item.playbackRate self.playbackRate = item.playbackRate()
} }
self.playbackRatePromise.set(self.playbackRate ?? 1.0) self.playbackRatePromise.set(self.playbackRate ?? 1.0)
@ -1782,6 +1793,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
}, close: { [weak mediaManager] in }, close: { [weak mediaManager] in
mediaManager?.setOverlayVideoNode(nil) mediaManager?.setOverlayVideoNode(nil)
}) })
let playbackRate = self.playbackRate
expandImpl = { [weak overlayNode] in expandImpl = { [weak overlayNode] in
guard let contentInfo = item.contentInfo, let overlayNode = overlayNode else { guard let contentInfo = item.contentInfo, let overlayNode = overlayNode else {
return return
@ -1789,7 +1803,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
switch contentInfo { switch contentInfo {
case let .message(message): case let .message(message):
let gallery = GalleryController(context: context, source: .peerMessagesAtId(messageId: message.id, chatLocation: .peer(message.id.peerId), chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil)), replaceRootController: { controller, ready in let gallery = GalleryController(context: context, source: .peerMessagesAtId(messageId: message.id, chatLocation: .peer(message.id.peerId), chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil)), playbackRate: playbackRate, replaceRootController: { controller, ready in
if let baseNavigationController = baseNavigationController { if let baseNavigationController = baseNavigationController {
baseNavigationController.replaceTopController(controller, animated: false, ready: ready) baseNavigationController.replaceTopController(controller, animated: false, ready: ready)
} }
@ -1884,6 +1898,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
}, close: { [weak mediaManager] in }, close: { [weak mediaManager] in
mediaManager?.setOverlayVideoNode(nil) mediaManager?.setOverlayVideoNode(nil)
}) })
let playbackRate = self.playbackRate
expandImpl = { [weak overlayNode] in expandImpl = { [weak overlayNode] in
guard let contentInfo = item.contentInfo, let overlayNode = overlayNode else { guard let contentInfo = item.contentInfo, let overlayNode = overlayNode else {
return return
@ -1891,7 +1908,7 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
switch contentInfo { switch contentInfo {
case let .message(message): case let .message(message):
let gallery = GalleryController(context: context, source: .peerMessagesAtId(messageId: message.id, chatLocation: .peer(message.id.peerId), chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil)), replaceRootController: { controller, ready in let gallery = GalleryController(context: context, source: .peerMessagesAtId(messageId: message.id, chatLocation: .peer(message.id.peerId), chatLocationContextHolder: Atomic<ChatLocationContextHolder?>(value: nil)), playbackRate: playbackRate, replaceRootController: { controller, ready in
if let baseNavigationController = baseNavigationController { if let baseNavigationController = baseNavigationController {
baseNavigationController.replaceTopController(controller, animated: false, ready: ready) baseNavigationController.replaceTopController(controller, animated: false, ready: ready)
} }

View File

@ -437,7 +437,7 @@ public final class SecretMediaPreviewController: ViewController {
} }
} }
guard let item = galleryItemForEntry(context: self.context, presentationData: self.presentationData, entry: MessageHistoryEntry(message: message, isRead: false, location: nil, monthLocation: nil, attributes: MutableMessageHistoryEntryAttributes(authorIsContact: false)), streamVideos: false, hideControls: true, isSecret: true, tempFilePath: tempFilePath, playbackCompleted: { [weak self] in guard let item = galleryItemForEntry(context: self.context, presentationData: self.presentationData, entry: MessageHistoryEntry(message: message, isRead: false, location: nil, monthLocation: nil, attributes: MutableMessageHistoryEntryAttributes(authorIsContact: false)), streamVideos: false, hideControls: true, isSecret: true, playbackRate: { nil }, tempFilePath: tempFilePath, playbackCompleted: { [weak self] in
self?.dismiss(forceAway: false) self?.dismiss(forceAway: false)
}, present: { _, _ in }) else { }, present: { _, _ in }) else {
self._ready.set(.single(true)) self._ready.set(.single(true))

View File

@ -112,7 +112,7 @@ public struct InstantPageGalleryEntry: Equatable {
nativeId = .instantPage(self.pageId, file.fileId) nativeId = .instantPage(self.pageId, file.fileId)
} }
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: NativeVideoContent(id: nativeId, fileReference: .webPage(webPage: WebpageReference(webPage), media: file), streamVideo: isMediaStreamable(media: file) ? .conservative : .none), originData: nil, indexData: indexData, contentInfo: .webPage(webPage, file, nil), caption: caption, credit: credit, fromPlayingVideo: fromPlayingVideo, landscape: landscape, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in }) return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: NativeVideoContent(id: nativeId, fileReference: .webPage(webPage: WebpageReference(webPage), media: file), streamVideo: isMediaStreamable(media: file) ? .conservative : .none), originData: nil, indexData: indexData, contentInfo: .webPage(webPage, file, nil), caption: caption, credit: credit, fromPlayingVideo: fromPlayingVideo, landscape: landscape, playbackRate: { nil }, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in })
} else { } else {
var representations: [TelegramMediaImageRepresentation] = [] var representations: [TelegramMediaImageRepresentation] = []
representations.append(contentsOf: file.previewRepresentations) representations.append(contentsOf: file.previewRepresentations)
@ -134,12 +134,12 @@ public struct InstantPageGalleryEntry: Equatable {
present(gallery, InstantPageGalleryControllerPresentationArguments(transitionArguments: { entry -> GalleryTransitionArguments? in present(gallery, InstantPageGalleryControllerPresentationArguments(transitionArguments: { entry -> GalleryTransitionArguments? in
return makeArguments() return makeArguments()
})) }))
}), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in }) }), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, playbackRate: { nil }, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in })
} else { } else {
if let content = WebEmbedVideoContent(webPage: embedWebpage, webpageContent: webpageContent, openUrl: { url in if let content = WebEmbedVideoContent(webPage: embedWebpage, webpageContent: webpageContent, openUrl: { url in
}) { }) {
return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: nil, indexData: nil, contentInfo: .webPage(webPage, embedWebpage, nil), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in }) return UniversalVideoGalleryItem(context: context, presentationData: presentationData, content: content, originData: nil, indexData: nil, contentInfo: .webPage(webPage, embedWebpage, nil), caption: NSAttributedString(string: ""), fromPlayingVideo: fromPlayingVideo, landscape: landscape, playbackRate: { nil }, performAction: { _ in }, openActionOptions: { _, _ in }, storeMediaPlaybackState: { _, _, _ in }, present: { _, _ in })
} else { } else {
preconditionFailure() preconditionFailure()
} }

View File

@ -246,7 +246,7 @@ final class ChatMediaInputGifPane: ChatMediaInputPane, UIScrollViewDelegate {
} }
multiplexedNode.didScroll = { [weak self] offset, height in multiplexedNode.didScroll = { [weak self] offset, height in
guard let strongSelf = self else { guard let strongSelf = self, let multiplexedNode = strongSelf.multiplexedNode else {
return return
} }
let absoluteOffset = -offset + 60.0 let absoluteOffset = -offset + 60.0

View File

@ -901,6 +901,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode, GalleryItemTransitio
strongSelf.videoNode?.isHidden = !owns strongSelf.videoNode?.isHidden = !owns
if owns { if owns {
strongSelf.videoNode?.setBaseRate(1.0) strongSelf.videoNode?.setBaseRate(1.0)
strongSelf.videoNode?.continuePlayingWithoutSound()
} }
} }
} }

View File

@ -879,6 +879,11 @@ public class ChatMessageItemView: ListViewItemNode {
override public func attachedHeaderNodesUpdated() { override public func attachedHeaderNodesUpdated() {
self.updateAttachedAvatarNodeOffset(offset: self.attachedAvatarNodeOffset, transition: .immediate) self.updateAttachedAvatarNodeOffset(offset: self.attachedAvatarNodeOffset, transition: .immediate)
for headerNode in self.attachedHeaderNodes {
if let headerNode = headerNode as? ChatMessageAvatarHeaderNode {
headerNode.updateSelectionState(animated: false)
}
}
} }
func updateAttachedAvatarNodeOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) { func updateAttachedAvatarNodeOffset(offset: CGFloat, transition: ContainedViewLayoutTransition) {

View File

@ -193,6 +193,7 @@ final class MultiplexedVideoNode: ASDisplayNode, UIScrollViewDelegate {
class DisplayLinkProxy: NSObject { class DisplayLinkProxy: NSObject {
weak var target: MultiplexedVideoNode? weak var target: MultiplexedVideoNode?
init(target: MultiplexedVideoNode) { init(target: MultiplexedVideoNode) {
self.target = target self.target = target
} }
@ -258,24 +259,6 @@ final class MultiplexedVideoNode: ASDisplayNode, UIScrollViewDelegate {
gesture.cancel() gesture.cancel()
} }
} }
self.contextContainerNode.customActivationProgress = { [weak self] progress, update in
guard let _ = self, let _ = gestureLocation else {
return
}
/*let minScale: CGFloat = (strongSelf.bounds.width - 10.0) / strongSelf.bounds.width
let currentScale = 1.0 * (1.0 - progress) + minScale * progress
switch update {
case .update:
strongSelf.layer.sublayerTransform = CATransform3DMakeScale(currentScale, currentScale, 1.0)
case .begin:
strongSelf.layer.sublayerTransform = CATransform3DMakeScale(currentScale, currentScale, 1.0)
case let .ended(previousProgress):
let previousScale = 1.0 * (1.0 - previousProgress) + minScale * previousProgress
strongSelf.layer.sublayerTransform = CATransform3DMakeScale(currentScale, currentScale, 1.0)
strongSelf.layer.animateSpring(from: previousScale as NSNumber, to: currentScale as NSNumber, keyPath: "sublayerTransform.scale", duration: 0.5, delay: 0.0, initialVelocity: 0.0, damping: 90.0)
}*/
}
} }
required init?(coder aDecoder: NSCoder) { required init?(coder aDecoder: NSCoder) {