diff --git a/TelegramUI.xcodeproj/project.pbxproj b/TelegramUI.xcodeproj/project.pbxproj index d3a9361552..9f34b723a6 100644 --- a/TelegramUI.xcodeproj/project.pbxproj +++ b/TelegramUI.xcodeproj/project.pbxproj @@ -2405,6 +2405,18 @@ name = "Radial Status"; sourceTree = ""; }; + D01848F021A2323D00B6DEBD /* Strings */ = { + isa = PBXGroup; + children = ( + D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */, + D05A32DB1E6EFCC2002760B4 /* NumericFormat.swift */, + D0BCC3D1203F0A6C008126C2 /* StringForMessageTimestampStatus.swift */, + D017494D1E1059570057C89A /* StringWithAppliedEntities.swift */, + 09C9EA3721A044B500E90146 /* StringForDuration.swift */, + ); + name = Strings; + sourceTree = ""; + }; D018D3331E6489D700C5E089 /* Create Channel */ = { isa = PBXGroup; children = ( @@ -4443,8 +4455,8 @@ D0383ED5207D19BC00C45548 /* Emoji */, D0B69C3A20EBD8B3003632C7 /* Device Access */, D01C7EFE1EF9D434008305F1 /* Device Contacts */, + D01848F021A2323D00B6DEBD /* Strings */, 09D304142173C0E900C00567 /* WatchManager.swift */, - D0B844551DAC3AEE005F29E1 /* PresenceStrings.swift */, D08775081E3E59DE00A97350 /* PeerNotificationSoundStrings.swift */, D0F69E931D6B8C9B0046BCD6 /* ProgressiveImage.swift */, D0F69E941D6B8C9B0046BCD6 /* WebP.swift */, @@ -4454,13 +4466,11 @@ D05811931DD5F9380057C769 /* TelegramApplicationContext.swift */, D023836F1DDF0462004018B6 /* UrlHandling.swift */, D0F917B41E0DA396003687E6 /* GenerateTextEntities.swift */, - D017494D1E1059570057C89A /* StringWithAppliedEntities.swift */, D01749541E1082770057C89A /* StoredMessageFromSearchPeer.swift */, D087750B1E3E7B7600A97350 /* PreferencesKeys.swift */, D01D6BFB1E42AB3C006151C6 /* EmojiUtils.swift */, D0DA44551E4E7F43005FDCA7 /* ShakeAnimation.swift */, D0E305A41E5B2BFB00D7A3A2 /* ValidateAddressNameInteractive.swift */, - D05A32DB1E6EFCC2002760B4 /* NumericFormat.swift */, D01C2AAC1E768404001F6F9A /* Markdown.swift */, D0F3A8AA1E82D83E00B4C64C /* TelegramAccountAuxiliaryMethods.swift */, D01BAA571ED3283D00295217 /* AddFormatToStringWithRanges.swift */, @@ -4478,7 +4488,6 @@ D04ECD711FFBF22B00DE9029 /* OpenUrl.swift */, D0FC194C201F82A000FEDBB2 /* OpenResolvedUrl.swift */, D00ACA592022897D0045D427 /* ProcessedPeerRestrictionText.swift */, - D0BCC3D1203F0A6C008126C2 /* StringForMessageTimestampStatus.swift */, D0E8B8B8204477B600605593 /* SecretChatKeyVisualization.swift */, D0FA08BD20481EA300DD23FC /* Locale.swift */, D0DE5804205B202500C356A8 /* ScreenCaptureDetection.swift */, @@ -4496,7 +4505,6 @@ 0902838C2194AEB90067EFBD /* ImageTransparency.swift */, 09C9EA32219F79F600E90146 /* ID3Artwork.h */, 09C9EA31219F79F500E90146 /* ID3Artwork.m */, - 09C9EA3721A044B500E90146 /* StringForDuration.swift */, ); name = Utils; sourceTree = ""; diff --git a/TelegramUI/ChatMessageInteractiveMediaNode.swift b/TelegramUI/ChatMessageInteractiveMediaNode.swift index 1e9858a7fb..caaf2aeff6 100644 --- a/TelegramUI/ChatMessageInteractiveMediaNode.swift +++ b/TelegramUI/ChatMessageInteractiveMediaNode.swift @@ -518,8 +518,12 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { progressRequired = true } else if isSecretMedia { progressRequired = true - } else if let webpage = webpage, case let .Loaded(content) = webpage.content, content.embedUrl != nil { - progressRequired = true + } else if let webpage = webpage, case let .Loaded(content) = webpage.content { + if content.embedUrl != nil { + progressRequired = true + } else if let file = content.file, file.isVideo, !file.isAnimated { + progressRequired = true + } } } else { progressRequired = true @@ -644,8 +648,12 @@ final class ChatMessageInteractiveMediaNode: ASDisplayNode { } else { state = .none } - } else if let webpage = webpage, case let .Loaded(content) = webpage.content, content.embedUrl != nil { - state = .play(bubbleTheme.mediaOverlayControlForegroundColor) + } else if let webpage = webpage, case let .Loaded(content) = webpage.content { + if content.embedUrl != nil { + state = .play(bubbleTheme.mediaOverlayControlForegroundColor) + } else if let file = content.file, file.isVideo, !file.isAnimated { + state = .play(bubbleTheme.mediaOverlayControlForegroundColor) + } } if case .constrained = sizeCalculation { if let file = media as? TelegramMediaFile, let duration = file.duration, !file.isAnimated { diff --git a/TelegramUI/GalleryController.swift b/TelegramUI/GalleryController.swift index cf37d43008..0cf606b137 100644 --- a/TelegramUI/GalleryController.swift +++ b/TelegramUI/GalleryController.swift @@ -122,6 +122,15 @@ func galleryCaptionStringWithAppliedEntities(_ text: String, entities: [MessageT return stringWithAppliedEntities(text, entities: entities, baseColor: .white, linkColor: UIColor(rgb: 0x5ac8fa), baseFont: textFont, linkFont: textFont, boldFont: boldFont, italicFont: italicFont, fixedFont: fixedFont, underlineLinks: false) } +private func galleryMessageCaptionText(_ message: Message) -> String { + for media in message.media { + if let _ = media as? TelegramMediaWebpage { + return "" + } + } + return message.text +} + func galleryItemForEntry(account: Account, presentationData: PresentationData, entry: MessageHistoryEntry, streamVideos: Bool, loopVideos: Bool = false, hideControls: Bool = false, playbackCompleted: @escaping () -> Void = {}, openUrl: @escaping (String) -> Void = { _ in }, openUrlOptions: @escaping (String) -> Void = { _ in }) -> GalleryItem? { switch entry { case let .MessageEntry(message, _, location, _): @@ -148,7 +157,7 @@ func galleryItemForEntry(account: Account, presentationData: PresentationData, e break } } - let caption = galleryCaptionStringWithAppliedEntities(message.text, entities: entities) + let caption = galleryCaptionStringWithAppliedEntities(galleryMessageCaptionText(message), entities: entities) return UniversalVideoGalleryItem(account: account, presentationData: presentationData, content: content, originData: GalleryItemOriginData(title: message.author?.displayTitle, timestamp: message.timestamp), indexData: location.flatMap { GalleryItemIndexData(position: Int32($0.index), totalCount: Int32($0.count)) }, contentInfo: .message(message), caption: caption, hideControls: hideControls, playbackCompleted: playbackCompleted, openUrl: openUrl, openUrlOptions: openUrlOptions) } else { if file.mimeType.hasPrefix("image/") && file.mimeType != "image/gif" { diff --git a/TelegramUI/UniversalVideoGalleryItem.swift b/TelegramUI/UniversalVideoGalleryItem.swift index 943a2a4f75..25b9990034 100644 --- a/TelegramUI/UniversalVideoGalleryItem.swift +++ b/TelegramUI/UniversalVideoGalleryItem.swift @@ -324,6 +324,9 @@ final class UniversalVideoGalleryItemNode: ZoomableContentGalleryItemNode { if let m = m as? TelegramMediaFile, m.isVideo { file = m break + } else if let m = m as? TelegramMediaWebpage, case let .Loaded(content) = m.content, let f = content.file, f.isVideo { + file = f + break } } if let file = file {