mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-05 19:28:46 +02:00
InstantPage: exclude audio/music from the rich-content gallery
openInstantPageMedia builds the gallery from allMedias() filtered to .image / .file. An audio track is an EngineMedia.file (a TelegramMediaFile with an .Audio attribute), so it passed the .file case and appeared as a gallery entry. Audio is enrolled in allMedias() only so the audio player can gather sibling tracks for its playlist (handleOpenAudioTap); it is not visual gallery content. Split the .file case to keep videos/gifs/documents but drop music and voice (!file.isMusic && !file.isVoice). No-op for V1 full-page Instant View (its mediasFromItems never enrolled audio); fixes the V2 rich bubble. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
parent
0a92dbddc3
commit
41aef1c928
1 changed files with 9 additions and 3 deletions
|
|
@ -13,8 +13,9 @@ import LocationUI
|
|||
/// - `.geo(map)` → pushes `LocationViewController` via `push`.
|
||||
/// - `.webpage(webPage)` cover → single-entry `InstantPageGalleryController`.
|
||||
/// - `.file(file)` with `isAnimated` → single-entry gallery in "playing video" mode.
|
||||
/// - Default → multi-entry gallery built from `allMedias` (filtered to `.image / .file`),
|
||||
/// centered on the tapped media; "playing video" mode is on.
|
||||
/// - Default → multi-entry gallery built from `allMedias` (filtered to `.image` and non-audio
|
||||
/// `.file` — audio/music siblings are excluded), centered on the tapped media; "playing
|
||||
/// video" mode is on.
|
||||
///
|
||||
/// Behavior matches V1's `InstantPageControllerNode.openMedia(_:)` bit-for-bit.
|
||||
///
|
||||
|
|
@ -66,8 +67,13 @@ public func openInstantPageMedia(
|
|||
fromPlayingVideo = true
|
||||
let filteredMedias = allMedias.filter { item in
|
||||
switch item.media {
|
||||
case .image, .file:
|
||||
case .image:
|
||||
return true
|
||||
case let .file(file):
|
||||
// Audio/music files are enrolled in `allMedias()` only so the audio playlist can
|
||||
// gather its siblings (see `handleOpenAudioTap`); they are not visual gallery
|
||||
// content, so keep videos/gifs/documents but exclude music and voice.
|
||||
return !file.isMusic && !file.isVoice
|
||||
default:
|
||||
return false
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue