mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Group image and video metadata in specialised structs (#3518)
This commit is contained in:
+11
-17
@@ -18,8 +18,7 @@ struct VideoRoomTimelineView: View {
|
||||
TimelineStyler(timelineItem: timelineItem) {
|
||||
VStack(alignment: .leading, spacing: 4) {
|
||||
thumbnail
|
||||
.timelineMediaFrame(height: timelineItem.content.thumbnailSize?.height,
|
||||
aspectRatio: timelineItem.content.aspectRatio)
|
||||
.timelineMediaFrame(imageInfo: timelineItem.content.thumbnailInfo)
|
||||
.accessibilityElement(children: .ignore)
|
||||
.accessibilityLabel(L10n.commonVideo)
|
||||
// This clip shape is distinct from the one in the styler as that one
|
||||
@@ -41,11 +40,11 @@ struct VideoRoomTimelineView: View {
|
||||
|
||||
@ViewBuilder
|
||||
var thumbnail: some View {
|
||||
if let thumbnailSource = timelineItem.content.thumbnailSource {
|
||||
if let thumbnailSource = timelineItem.content.thumbnailInfo?.source {
|
||||
LoadableImage(mediaSource: thumbnailSource,
|
||||
mediaType: .timelineItem,
|
||||
blurhash: timelineItem.content.blurhash,
|
||||
size: timelineItem.content.thumbnailSize,
|
||||
size: timelineItem.content.thumbnailInfo?.size,
|
||||
mediaProvider: context.mediaProvider) { imageView in
|
||||
imageView
|
||||
.overlay { playIcon }
|
||||
@@ -89,9 +88,8 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "video.mp4",
|
||||
duration: 21,
|
||||
source: nil,
|
||||
thumbnailSource: nil)))
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: nil)))
|
||||
|
||||
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
@@ -101,9 +99,8 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "other.mp4",
|
||||
duration: 22,
|
||||
source: nil,
|
||||
thumbnailSource: nil)))
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: nil)))
|
||||
|
||||
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
@@ -113,10 +110,8 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "Blurhashed.mp4",
|
||||
duration: 23,
|
||||
source: nil,
|
||||
aspectRatio: 0.7,
|
||||
thumbnailSource: nil,
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: nil,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW")))
|
||||
|
||||
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
|
||||
@@ -128,9 +123,8 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "video.mp4",
|
||||
caption: "This is a caption",
|
||||
duration: 21,
|
||||
source: nil,
|
||||
thumbnailSource: nil)))
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: nil)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user