mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-08-01 16:06:59 +00:00
Various fixes
This commit is contained in:
parent
8751480c2c
commit
1113279e17
@ -1481,7 +1481,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode {
|
||||
if strongSelf.actionAtEnd == .stop && strongSelf.isCentral == true {
|
||||
strongSelf.isPlayingPromise.set(false)
|
||||
strongSelf.isPlaying = false
|
||||
strongSelf.updateControlsVisibility(true)
|
||||
if !item.isSecret {
|
||||
strongSelf.updateControlsVisibility(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -103,6 +103,8 @@ private final class SecretMediaPreviewControllerNode: GalleryControllerNode {
|
||||
}
|
||||
}
|
||||
|
||||
var onDismissTransitionUpdate: (CGFloat) -> Void = { _ in }
|
||||
|
||||
override func animateIn(animateContent: Bool, useSimpleAnimation: Bool) {
|
||||
super.animateIn(animateContent: animateContent, useSimpleAnimation: useSimpleAnimation)
|
||||
|
||||
@ -119,6 +121,7 @@ private final class SecretMediaPreviewControllerNode: GalleryControllerNode {
|
||||
|
||||
override func updateDismissTransition(_ value: CGFloat) {
|
||||
self.timeoutNode?.alpha = value
|
||||
self.onDismissTransitionUpdate(value)
|
||||
}
|
||||
|
||||
override func containerLayoutUpdated(_ layout: ContainerViewLayout, navigationBarHeight: CGFloat, transition: ContainedViewLayoutTransition) {
|
||||
@ -157,6 +160,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
private var currentNodeMessageId: MessageId?
|
||||
private var currentNodeMessageIsVideo = false
|
||||
private var currentNodeMessageIsViewOnce = false
|
||||
private var currentMessageIsDismissed = false
|
||||
private var tempFile: TempBoxFile?
|
||||
|
||||
private let centralItemAttributesDisposable = DisposableSet();
|
||||
@ -252,6 +256,12 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
}
|
||||
}
|
||||
|
||||
self.controllerNode.onDismissTransitionUpdate = { [weak self] _ in
|
||||
if let self {
|
||||
self.dismissAllTooltips()
|
||||
}
|
||||
}
|
||||
|
||||
self.controllerNode.statusBar = self.statusBar
|
||||
self.controllerNode.navigationBar = self.navigationBar
|
||||
|
||||
@ -270,11 +280,6 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
self.controllerNode.dismiss = { [weak self] in
|
||||
self?._hiddenMedia.set(.single(nil))
|
||||
self?.presentingViewController?.dismiss(animated: false, completion: nil)
|
||||
|
||||
if let tooltipController = self?.tooltipController {
|
||||
self?.tooltipController = nil
|
||||
tooltipController.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
self.controllerNode.beginCustomDismiss = { [weak self] _ in
|
||||
@ -311,7 +316,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
|
||||
if let countdownBeginTime = attribute.countdownBeginTime {
|
||||
if let videoDuration = videoDuration, attribute.timeout != viewOnceTimeout {
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, videoDuration)
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, max(videoDuration, Double(attribute.timeout)))
|
||||
} else {
|
||||
beginTimeAndTimeout = (Double(countdownBeginTime), Double(attribute.timeout))
|
||||
}
|
||||
@ -321,7 +326,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
|
||||
if let countdownBeginTime = attribute.countdownBeginTime {
|
||||
if let videoDuration = videoDuration, attribute.timeout != viewOnceTimeout {
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, videoDuration)
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, max(videoDuration, Double(attribute.timeout)))
|
||||
} else {
|
||||
beginTimeAndTimeout = (Double(countdownBeginTime), Double(attribute.timeout))
|
||||
}
|
||||
@ -448,10 +453,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
}
|
||||
|
||||
private func dismiss(forceAway: Bool) {
|
||||
if let tooltipController = self.tooltipController {
|
||||
self.tooltipController = nil
|
||||
tooltipController.dismiss()
|
||||
}
|
||||
self.dismissAllTooltips()
|
||||
|
||||
var animatedOutNode = true
|
||||
var animatedOutInterface = false
|
||||
@ -494,6 +496,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
if self.currentNodeMessageId != message.id {
|
||||
self.currentNodeMessageId = message.id
|
||||
var tempFilePath: String?
|
||||
var duration: Double = 0.0
|
||||
for media in message.media {
|
||||
if let file = media as? TelegramMediaFile {
|
||||
if let path = self.context.account.postbox.mediaBox.completedResourcePath(file.resource) {
|
||||
@ -502,13 +505,14 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
tempFilePath = tempFile.path
|
||||
self.currentNodeMessageIsVideo = true
|
||||
}
|
||||
duration = file.duration ?? 0.0
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
if let self {
|
||||
if self.currentNodeMessageIsViewOnce {
|
||||
if self.currentNodeMessageIsViewOnce || (duration < 30.0 && !self.currentMessageIsDismissed) {
|
||||
if let node = self.controllerNode.pager.centralItemNode() as? UniversalVideoGalleryItemNode {
|
||||
node.seekToStart()
|
||||
}
|
||||
@ -538,7 +542,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
if let attribute = message.autoclearAttribute {
|
||||
if let countdownBeginTime = attribute.countdownBeginTime {
|
||||
if let videoDuration = videoDuration, attribute.timeout != viewOnceTimeout {
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, videoDuration)
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, max(videoDuration, Double(attribute.timeout)))
|
||||
} else {
|
||||
beginTimeAndTimeout = (Double(countdownBeginTime), Double(attribute.timeout))
|
||||
}
|
||||
@ -546,7 +550,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
} else if let attribute = message.autoremoveAttribute {
|
||||
if let countdownBeginTime = attribute.countdownBeginTime {
|
||||
if let videoDuration = videoDuration, attribute.timeout != viewOnceTimeout {
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, videoDuration)
|
||||
beginTimeAndTimeout = (CFAbsoluteTimeGetCurrent() + NSTimeIntervalSince1970, max(videoDuration, Double(attribute.timeout)))
|
||||
} else {
|
||||
beginTimeAndTimeout = (Double(countdownBeginTime), Double(attribute.timeout))
|
||||
}
|
||||
@ -566,6 +570,14 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
if !(self.currentNodeMessageIsVideo || self.currentNodeMessageIsViewOnce) {
|
||||
self.dismiss()
|
||||
}
|
||||
self.currentMessageIsDismissed = true
|
||||
}
|
||||
}
|
||||
|
||||
private func dismissAllTooltips() {
|
||||
if let tooltipController = self.tooltipController {
|
||||
self.tooltipController = nil
|
||||
tooltipController.dismiss()
|
||||
}
|
||||
}
|
||||
|
||||
@ -574,10 +586,7 @@ public final class SecretMediaPreviewController: ViewController {
|
||||
return
|
||||
}
|
||||
|
||||
if let tooltipController = self.tooltipController {
|
||||
self.tooltipController = nil
|
||||
tooltipController.dismiss()
|
||||
}
|
||||
self.dismissAllTooltips()
|
||||
|
||||
let absoluteFrame = sourceView.convert(sourceView.bounds, to: nil)
|
||||
let location = CGRect(origin: CGPoint(x: absoluteFrame.midX, y: absoluteFrame.maxY + 2.0), size: CGSize())
|
||||
|
@ -384,6 +384,8 @@
|
||||
|
||||
id<TGModernGalleryEditableItem> galleryEditableItem = (id<TGModernGalleryEditableItem>)strongSelf->_currentItem;
|
||||
[strongSelf->_editingContext setTimer:timeout forItem:galleryEditableItem.editableMediaItem];
|
||||
|
||||
[strongSelf->_selectionContext setItem:(id<TGMediaSelectableItem>)galleryEditableItem.editableMediaItem selected:true animated:true sender:nil];
|
||||
};
|
||||
|
||||
_captionMixin.stickersContext = stickersContext;
|
||||
@ -1328,6 +1330,7 @@
|
||||
|
||||
- (void)setTransitionOutProgress:(CGFloat)transitionOutProgress manual:(bool)manual
|
||||
{
|
||||
[_captionMixin onAnimateOut];
|
||||
if (transitionOutProgress > FLT_EPSILON)
|
||||
[self setAllInterfaceHidden:true delay:0.0 animated:true];
|
||||
else if (!manual)
|
||||
|
@ -100,7 +100,7 @@ public class LegacyMessageInputPanelNode: ASDisplayNode, TGCaptionPanelView {
|
||||
}
|
||||
|
||||
public func onAnimateOut() {
|
||||
self.tooltipController?.dismiss()
|
||||
self.dismissTimeoutTooltip()
|
||||
}
|
||||
|
||||
public func baseHeight() -> CGFloat {
|
||||
|
Loading…
x
Reference in New Issue
Block a user