mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Add the gallery timeline item rendered as a placeholder
Introduces the GalleryRoomTimelineItem and its typed GalleryItem model (reusing the existing per-message content types), builds it in the RoomTimelineItemFactory and routes it through RoomTimelineItemView. For now it renders as a placeholder; the grid/list media views and the full-screen preview land in follow-up PRs. Co-authored-by: svetoslav.mitov <svetoslav.mitov@sportinno.com>
This commit is contained in:
@@ -95,7 +95,7 @@ struct SearchScreenMessage: Identifiable, Equatable {
|
||||
content.formattedBody ?? AttributedString(content.body)
|
||||
case .emote(let content):
|
||||
content.formattedBody ?? AttributedString(content.body)
|
||||
case .audio, .file, .image, .video:
|
||||
case .audio, .file, .image, .video, .gallery:
|
||||
nil
|
||||
case .voice:
|
||||
AttributedString(L10n.commonVoiceMessage)
|
||||
@@ -130,7 +130,7 @@ struct SearchScreenMessage: Identifiable, Equatable {
|
||||
return .init(title: content.caption ?? content.filename,
|
||||
details: mediaDetails(filename: content.filename, fileSize: content.videoInfo.fileSize),
|
||||
kind: .video(thumbnail: content.thumbnailInfo, blurhash: content.blurhash))
|
||||
case .text, .notice, .emote, .voice, .location:
|
||||
case .text, .notice, .emote, .voice, .location, .gallery:
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
@@ -129,6 +129,13 @@ struct TimelineReplyView: View {
|
||||
plainBody: L10n.commonSharedLocation,
|
||||
formattedBody: nil,
|
||||
icon: .init(kind: .icon(\.locationPin)))
|
||||
case .gallery(let content):
|
||||
ReplyView(sender: sender,
|
||||
plainBody: content.caption ?? content.body,
|
||||
formattedBody: content.formattedCaption,
|
||||
icon: content.items.first?.thumbnailSource.map { .init(kind: .mediaSource($0)) }
|
||||
?? content.items.first?.mediaSource.map { .init(kind: .mediaSource($0)) }
|
||||
?? .init(kind: .icon(\.attachment)))
|
||||
}
|
||||
case .poll(let question):
|
||||
ReplyView(sender: sender,
|
||||
|
||||
@@ -82,6 +82,12 @@ struct TimelineThreadSummaryView: View {
|
||||
plainBody: L10n.commonSharedLocation,
|
||||
formattedBody: nil,
|
||||
numberOfReplies: numberOfReplies)
|
||||
case .gallery(let content):
|
||||
ThreadView(senderID: senderID,
|
||||
sender: sender,
|
||||
plainBody: content.caption ?? content.body,
|
||||
formattedBody: content.formattedCaption,
|
||||
numberOfReplies: numberOfReplies)
|
||||
}
|
||||
case .poll(let question):
|
||||
ThreadView(senderID: senderID,
|
||||
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
//
|
||||
// Copyright 2026 Element Creations Ltd.
|
||||
//
|
||||
// SPDX-License-Identifier: AGPL-3.0-only OR LicenseRef-Element-Commercial.
|
||||
// Please see LICENSE files in the repository root for full details.
|
||||
//
|
||||
|
||||
import Compound
|
||||
import SwiftUI
|
||||
|
||||
struct GalleryRoomTimelineView: View {
|
||||
let timelineItem: GalleryRoomTimelineItem
|
||||
|
||||
var body: some View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
// Placeholder rendering — the grid/list media views land in a follow-up.
|
||||
FormattedBodyText(text: timelineItem.content.caption ?? timelineItem.content.body,
|
||||
trailingReservedSize: timelineItem.trailingReservedSize,
|
||||
boostFontSize: timelineItem.shouldBoost)
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user