mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Open a full-screen preview when tapping a gallery item
Tapping a gallery tile/row opens the existing media preview scoped to that gallery's attachments, paging between them. Introduces a typed MediaPreviewItemID (replacing the stringly-typed preview identifier) and a gallery-scoped TimelineMediaPreviewDataSource; the tap routes through TimelineInteractionHandler/TimelineViewModel. Non-previewable (.other) items are skipped without shifting the tapped index. Co-authored-by: svetoslav.mitov <svetoslav.mitov@sportinno.com> just use id instead of previewID removed horrible multiline ternary pr suggestions remove redundant code remove empty caption display + gallery uses the appropriate media timeline actions
This commit is contained in:
+8
-6
@@ -27,15 +27,13 @@ struct GalleryRoomTimelineView: View {
|
||||
if usesListLayout {
|
||||
GalleryListView(items: timelineItem.content.items,
|
||||
mediaProvider: context?.mediaProvider,
|
||||
contentScannerService: context?.contentScannerService) { _ in
|
||||
// Tapping to open the full-screen preview lands in a follow-up.
|
||||
}
|
||||
contentScannerService: context?.contentScannerService,
|
||||
onItemTap: tap)
|
||||
} else {
|
||||
GalleryGridView(items: timelineItem.content.items,
|
||||
mediaProvider: context?.mediaProvider,
|
||||
contentScannerService: context?.contentScannerService) { _ in
|
||||
// Tapping to open the full-screen preview lands in a follow-up.
|
||||
}
|
||||
contentScannerService: context?.contentScannerService,
|
||||
onItemTap: tap)
|
||||
}
|
||||
|
||||
if hasMediaCaption {
|
||||
@@ -61,6 +59,10 @@ struct GalleryRoomTimelineView: View {
|
||||
boostFontSize: timelineItem.shouldBoost)
|
||||
}
|
||||
}
|
||||
|
||||
private func tap(index: Int) {
|
||||
context?.send(viewAction: .galleryItemTapped(itemID: timelineItem.id, index: index))
|
||||
}
|
||||
}
|
||||
|
||||
// MARK: - Previews
|
||||
|
||||
Reference in New Issue
Block a user