Add new development assets and use in mocks/previews. (#3581)

This commit is contained in:
Doug
2024-12-03 17:14:05 +00:00
committed by GitHub
parent c566c64c78
commit 4966083b58
194 changed files with 501 additions and 492 deletions
@@ -5,7 +5,7 @@
// Please see LICENSE in the repository root for full details.
//
import Foundation
import Compound
import SwiftUI
struct VideoRoomTimelineView: View {
@@ -78,56 +78,37 @@ struct VideoRoomTimelineView_Previews: PreviewProvider, TestablePreview {
static let viewModel = TimelineViewModel.mock
static var previews: some View {
body.environmentObject(viewModel.context)
ScrollView {
VStack(spacing: 20.0) {
VideoRoomTimelineView(timelineItem: makeTimelineItem())
VideoRoomTimelineView(timelineItem: makeTimelineItem(isEdited: true))
// Blurhash item?
VideoRoomTimelineView(timelineItem: makeTimelineItem(caption: "This is a great image 😎"))
VideoRoomTimelineView(timelineItem: makeTimelineItem(caption: "This is a great image with a really long multiline caption",
isEdited: true))
}
}
.environmentObject(viewModel.context)
.environment(\.timelineContext, viewModel.context)
.previewLayout(.fixed(width: 390, height: 975))
.padding(.bottom, 20)
}
static var body: some View {
VStack(spacing: 20.0) {
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
timestamp: "Now",
isOutgoing: false,
isEditable: false,
canBeRepliedTo: true,
isThreaded: false,
sender: .init(id: "Bob"),
content: .init(filename: "video.mp4",
videoInfo: .mockVideo,
thumbnailInfo: nil)))
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
timestamp: "Now",
isOutgoing: false,
isEditable: false,
canBeRepliedTo: true,
isThreaded: false,
sender: .init(id: "Bob"),
content: .init(filename: "other.mp4",
videoInfo: .mockVideo,
thumbnailInfo: nil)))
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
timestamp: "Now",
isOutgoing: false,
isEditable: false,
canBeRepliedTo: true,
isThreaded: false,
sender: .init(id: "Bob"),
content: .init(filename: "Blurhashed.mp4",
videoInfo: .mockVideo,
thumbnailInfo: nil,
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW")))
VideoRoomTimelineView(timelineItem: VideoRoomTimelineItem(id: .randomEvent,
timestamp: "Now",
isOutgoing: false,
isEditable: false,
canBeRepliedTo: true,
isThreaded: false,
sender: .init(id: "Bob"),
content: .init(filename: "video.mp4",
caption: "This is a caption",
videoInfo: .mockVideo,
thumbnailInfo: nil)))
}
private static func makeTimelineItem(caption: String? = nil, isEdited: Bool = false) -> VideoRoomTimelineItem {
VideoRoomTimelineItem(id: .randomEvent,
timestamp: "Now",
isOutgoing: false,
isEditable: false,
canBeRepliedTo: true,
isThreaded: false,
sender: .init(id: "Bob"),
content: .init(filename: "video.mp4",
caption: caption,
videoInfo: .mockVideo,
thumbnailInfo: .mockVideoThumbnail,
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW"),
properties: .init(isEdited: isEdited))
}
}