mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-16 19:30:29 +00:00
Disable autoplayback for grouped videos
This commit is contained in:
parent
b04d42e547
commit
a7d73095eb
@ -152,6 +152,10 @@ class AutodownloadDataUsagePickerItemNode: ListViewItemNode {
|
||||
}
|
||||
|
||||
sliderView.value = CGFloat(value)
|
||||
|
||||
sliderView.isUserInteractionEnabled = item.enabled
|
||||
sliderView.alpha = item.enabled ? 1.0 : 0.4
|
||||
sliderView.layer.allowsGroupOpacity = !item.enabled
|
||||
}
|
||||
}
|
||||
|
||||
@ -194,6 +198,8 @@ class AutodownloadDataUsagePickerItemNode: ListViewItemNode {
|
||||
self.view.addSubview(sliderView)
|
||||
sliderView.addTarget(self, action: #selector(self.sliderValueChanged), for: .valueChanged)
|
||||
self.sliderView = sliderView
|
||||
|
||||
self.updateSliderView()
|
||||
}
|
||||
|
||||
func asyncLayout() -> (_ item: AutodownloadDataUsagePickerItem, _ params: ListViewItemLayoutParams, _ neighbors: ItemListNeighbors) -> (ListViewItemNodeLayout, () -> Void) {
|
||||
@ -299,10 +305,6 @@ class AutodownloadDataUsagePickerItemNode: ListViewItemNode {
|
||||
sliderView.knobImage = generateKnobImage()
|
||||
}
|
||||
|
||||
sliderView.isUserInteractionEnabled = item.enabled
|
||||
sliderView.alpha = item.enabled ? 1.0 : 0.4
|
||||
sliderView.layer.allowsGroupOpacity = !item.enabled
|
||||
|
||||
sliderView.frame = CGRect(origin: CGPoint(x: params.leftInset + 15.0, y: 37.0), size: CGSize(width: params.width - params.leftInset - params.rightInset - 15.0 * 2.0, height: 44.0))
|
||||
sliderView.hitTestEdgeInsets = UIEdgeInsetsMake(-sliderView.frame.minX, 0.0, 0.0, -sliderView.frame.minX)
|
||||
|
||||
|
||||
@ -447,7 +447,7 @@ final class ChatMessageAttachedContentNode: ASDisplayNode {
|
||||
initialWidth = initialImageWidth + horizontalInsets.left + horizontalInsets.right
|
||||
refineContentImageLayout = refineLayout
|
||||
} else if let wallpaper = media as? WallpaperPreviewMedia {
|
||||
let (_, initialImageWidth, refineLayout) = contentImageLayout(context, presentationData.theme.theme, presentationData.strings, message, wallpaper, .full, associatedData.automaticDownloadPeerType, automaticDownloadSettings.autoplayGifs, .constrained(CGSize(width: constrainedSize.width - horizontalInsets.left - horizontalInsets.right, height: constrainedSize.height)), layoutConstants, contentMode)
|
||||
let (_, initialImageWidth, refineLayout) = contentImageLayout(context, presentationData.theme.theme, presentationData.strings, message, wallpaper, .full, associatedData.automaticDownloadPeerType, false, .constrained(CGSize(width: constrainedSize.width - horizontalInsets.left - horizontalInsets.right, height: constrainedSize.height)), layoutConstants, contentMode)
|
||||
initialWidth = initialImageWidth + horizontalInsets.left + horizontalInsets.right
|
||||
refineContentImageLayout = refineLayout
|
||||
}
|
||||
|
||||
@ -375,13 +375,6 @@ class ChatMessageBubbleItemNode: ChatMessageItemView {
|
||||
}
|
||||
}
|
||||
|
||||
var isInlinePlayableVideo = false
|
||||
for media in item.content.firstMessage.media {
|
||||
if let file = media as? TelegramMediaFile, file.isVideo, !file.isAnimated, isMediaStreamable(message: item.content.firstMessage, media: file) {
|
||||
isInlinePlayableVideo = true
|
||||
}
|
||||
}
|
||||
|
||||
if hasAvatar {
|
||||
avatarInset = layoutConstants.avatarDiameter
|
||||
} else {
|
||||
|
||||
@ -581,7 +581,7 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
}
|
||||
|
||||
if let videoNode = strongSelf.videoNode {
|
||||
if replaceVideoNode == nil, let decoration = videoNode.decoration as? ChatBubbleVideoDecoration, decoration.corners != corners {
|
||||
if !(replaceVideoNode ?? false), let decoration = videoNode.decoration as? ChatBubbleVideoDecoration, decoration.corners != corners {
|
||||
decoration.updateCorners(corners)
|
||||
}
|
||||
|
||||
@ -904,16 +904,16 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode {
|
||||
}
|
||||
} else {
|
||||
if isMediaStreamable(message: message, media: file), let _ = file.size {
|
||||
if !message.flags.contains(.Unsent) {
|
||||
if automaticPlayback, let duration = file.duration {
|
||||
if automaticPlayback && !message.flags.contains(.Unsent), let duration = file.duration {
|
||||
let durationString = stringForDuration(playerDuration > 0 ? playerDuration : duration, position: playerPosition)
|
||||
badgeContent = .text(inset: 0.0, backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, shape: .round, text: NSAttributedString(string: durationString))
|
||||
} else {
|
||||
let progressString = String(format: "%d%%", Int(progress * 100.0))
|
||||
badgeContent = .text(inset: 12.0, backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, shape: .round, text: NSAttributedString(string: progressString))
|
||||
badgeContent = .text(inset: message.flags.contains(.Unsent) ? 0.0 : 12.0, backgroundColor: bubbleTheme.mediaDateAndStatusFillColor, foregroundColor: bubbleTheme.mediaDateAndStatusTextColor, shape: .round, text: NSAttributedString(string: progressString))
|
||||
}
|
||||
mediaDownloadState = automaticPlayback ? .none : .compactFetching(progress: progress)
|
||||
|
||||
if !message.flags.contains(.Unsent) {
|
||||
mediaDownloadState = automaticPlayback ? .none : .compactFetching(progress: progress)
|
||||
state = automaticPlayback ? .none : .play(bubbleTheme.mediaOverlayControlForegroundColor)
|
||||
}
|
||||
} else {
|
||||
|
||||
@ -80,8 +80,7 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
if telegramFile.isAnimated {
|
||||
automaticPlayback = item.controllerInteraction.automaticMediaDownloadSettings.autoplayGifs
|
||||
contentMode = .aspectFill
|
||||
} else {
|
||||
if item.controllerInteraction.automaticMediaDownloadSettings.autoplayVideos {
|
||||
} else if telegramFile.isVideo && item.controllerInteraction.automaticMediaDownloadSettings.autoplayVideos, case .linear = preparePosition {
|
||||
var willDownloadOrLocal = false
|
||||
if case .full = automaticDownload {
|
||||
willDownloadOrLocal = true
|
||||
@ -95,7 +94,6 @@ class ChatMessageMediaBubbleContentNode: ChatMessageBubbleContentNode {
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var hasReplyMarkup: Bool = false
|
||||
for attribute in item.message.attributes {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user