mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-02 21:33:26 +00:00
Add new development assets and use in mocks/previews. (#3581)
This commit is contained in:
@@ -18,9 +18,26 @@ extension MediaProviderMock {
|
||||
return nil
|
||||
}
|
||||
|
||||
// At some stage it would be nice to return different images, but for now they can be the same.
|
||||
if mediaSource?.url == .mockMXCImage || mediaSource?.url == .mockMXCAvatar {
|
||||
return Asset.Images.appLogo.image
|
||||
if mediaSource?.url == .mockMXCImage {
|
||||
if let url = Bundle.main.url(forResource: "preview_image", withExtension: "jpg"),
|
||||
let data = try? Data(contentsOf: url) {
|
||||
return UIImage(data: data)
|
||||
}
|
||||
} else if mediaSource?.url == .mockMXCVideo {
|
||||
if let url = Bundle.main.url(forResource: "preview_video", withExtension: "jpg"),
|
||||
let data = try? Data(contentsOf: url) {
|
||||
return UIImage(data: data)
|
||||
}
|
||||
} else if mediaSource?.url == .mockMXCAvatar {
|
||||
if let url = Bundle.main.url(forResource: "preview_avatar_room", withExtension: "jpg"),
|
||||
let data = try? Data(contentsOf: url) {
|
||||
return UIImage(data: data)
|
||||
}
|
||||
} else if mediaSource?.url == .mockMXCUserAvatar {
|
||||
if let url = Bundle.main.url(forResource: "preview_avatar_user", withExtension: "jpg"),
|
||||
let data = try? Data(contentsOf: url) {
|
||||
return UIImage(data: data)
|
||||
}
|
||||
}
|
||||
|
||||
return UIImage(systemName: "photo")
|
||||
|
||||
@@ -43,14 +43,14 @@ extension RoomMemberProxyMock {
|
||||
static var mockMe: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@me:matrix.org",
|
||||
displayName: "Me",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
avatarURL: .mockMXCUserAvatar,
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
static var mockMeAdmin: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@me:matrix.org",
|
||||
displayName: "Me",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
avatarURL: .mockMXCUserAvatar,
|
||||
membership: .join,
|
||||
powerLevel: 100,
|
||||
role: .administrator))
|
||||
@@ -83,7 +83,7 @@ extension RoomMemberProxyMock {
|
||||
static var mockDan: RoomMemberProxyMock {
|
||||
RoomMemberProxyMock(with: .init(userID: "@dan:matrix.org",
|
||||
displayName: "Dan",
|
||||
avatarURL: .mockMXCAvatar,
|
||||
avatarURL: .mockMXCUserAvatar,
|
||||
membership: .join))
|
||||
}
|
||||
|
||||
|
||||
@@ -103,9 +103,10 @@ extension URL: @retroactive ExpressibleByStringLiteral {
|
||||
|
||||
// MARK: Mocks
|
||||
|
||||
static var mockMXCAudio: URL { "mxc://matrix.org/1234567890FiLe" }
|
||||
static var mockMXCAudio: URL { "mxc://matrix.org/1234567890AuDiO" }
|
||||
static var mockMXCFile: URL { "mxc://matrix.org/1234567890FiLe" }
|
||||
static var mockMXCImage: URL { "mxc://matrix.org/1234567890ImAgE" }
|
||||
static var mockMXCVideo: URL { "mxc://matrix.org/1234567890ViDeO" }
|
||||
static var mockMXCAvatar: URL { "mxc://matrix.org/1234567890AvAtAr" }
|
||||
static var mockMXCUserAvatar: URL { "mxc://matrix.org/1234567890AvAtArUsEr" }
|
||||
}
|
||||
|
||||
@@ -201,7 +201,7 @@ private extension HomeScreenRoom {
|
||||
let inviter = RoomMemberProxyMock()
|
||||
inviter.displayName = "Luca"
|
||||
inviter.userID = "@jack:somewhi.nl"
|
||||
inviter.avatarURL = avatarURL
|
||||
inviter.avatarURL = avatarURL.map { _ in .mockMXCUserAvatar }
|
||||
|
||||
let summary = RoomSummary(roomListItem: RoomListItemSDKMock(),
|
||||
id: "@someone:somewhere.com",
|
||||
|
||||
+2
-2
@@ -88,13 +88,13 @@ struct RoomMembersListMemberCell_Previews: PreviewProvider, TestablePreview {
|
||||
.mockAdmin,
|
||||
.mockModerator,
|
||||
.init(with: .init(userID: "@nodisplayname:matrix.org", membership: .join)),
|
||||
.init(with: .init(userID: "@avatar:matrix.org", displayName: "Avatar", avatarURL: .mockMXCAvatar, membership: .join))
|
||||
.init(with: .init(userID: "@avatar:matrix.org", displayName: "Avatar", avatarURL: .mockMXCUserAvatar, membership: .join))
|
||||
]
|
||||
|
||||
static let bannedMembers: [RoomMemberProxyMock] = [
|
||||
.init(with: .init(userID: "@nodisplayname:matrix.org", membership: .ban)),
|
||||
.init(with: .init(userID: "@fake:matrix.org", displayName: "President", membership: .ban)),
|
||||
.init(with: .init(userID: "@badavatar:matrix.org", avatarURL: .mockMXCAvatar, membership: .ban))
|
||||
.init(with: .init(userID: "@badavatar:matrix.org", avatarURL: .mockMXCUserAvatar, membership: .ban))
|
||||
]
|
||||
|
||||
static let viewModel = RoomMembersListScreenViewModel(roomProxy: JoinedRoomProxyMock(.init(name: "Some room",
|
||||
|
||||
+1
-1
@@ -118,7 +118,7 @@ struct CompletionSuggestion_Previews: PreviewProvider, TestablePreview {
|
||||
VStack(spacing: 8) {
|
||||
CompletionSuggestionView(mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
items: [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCAvatar, range: .init()))]) { _ in }
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCUserAvatar, range: .init()))]) { _ in }
|
||||
}
|
||||
VStack(spacing: 8) {
|
||||
CompletionSuggestionView(mediaProvider: MediaProviderMock(configuration: .init()),
|
||||
|
||||
@@ -304,7 +304,7 @@ struct ComposerToolbar_Previews: PreviewProvider, TestablePreview {
|
||||
analyticsService: ServiceLocator.shared.analytics,
|
||||
composerDraftService: ComposerDraftServiceMock())
|
||||
static let suggestions: [SuggestionItem] = [.user(item: MentionSuggestionItem(id: "@user_mention_1:matrix.org", displayName: "User 1", avatarURL: nil, range: .init())),
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCAvatar, range: .init()))]
|
||||
.user(item: MentionSuggestionItem(id: "@user_mention_2:matrix.org", displayName: "User 2", avatarURL: .mockMXCUserAvatar, range: .init()))]
|
||||
|
||||
static var previews: some View {
|
||||
ComposerToolbar.mock(focused: true)
|
||||
|
||||
+1
-1
@@ -38,7 +38,7 @@ struct MentionSuggestionItemView_Previews: PreviewProvider, TestablePreview {
|
||||
static let mockMediaProvider = MediaProviderMock(configuration: .init())
|
||||
|
||||
static var previews: some View {
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test", displayName: "Test", avatarURL: .mockMXCAvatar, range: .init()))
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test", displayName: "Test", avatarURL: .mockMXCUserAvatar, range: .init()))
|
||||
MentionSuggestionItemView(mediaProvider: mockMediaProvider, item: .init(id: "test2", displayName: nil, avatarURL: nil, range: .init()))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -267,7 +267,7 @@ struct MessageComposer_Previews: PreviewProvider, TestablePreview {
|
||||
eventContent: .message(.video(.init(filename: "never.mov",
|
||||
caption: "Video: Through the never",
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: .mockThumbnail)))),
|
||||
thumbnailInfo: .mockVideoThumbnail)))),
|
||||
.loading(eventID: "")
|
||||
]
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ struct ReadReceiptCell_Previews: PreviewProvider, TestablePreview {
|
||||
ReadReceiptCell(readReceipt: .init(userID: "@test:matrix.org",
|
||||
formattedTimestamp: "10:00"),
|
||||
memberState: .init(displayName: "Test",
|
||||
avatarURL: .mockMXCAvatar),
|
||||
avatarURL: .mockMXCUserAvatar),
|
||||
mediaProvider: MediaProviderMock(configuration: .init()))
|
||||
.previewDisplayName("With Image")
|
||||
ReadReceiptCell(readReceipt: .init(userID: "@test:matrix.org",
|
||||
|
||||
@@ -277,7 +277,7 @@ struct TimelineReplyView_Previews: PreviewProvider, TestablePreview {
|
||||
eventContent: .message(.video(.init(filename: "video.mp4",
|
||||
caption: "Some video",
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: .mockThumbnail))))),
|
||||
thumbnailInfo: .mockVideoThumbnail))))),
|
||||
TimelineReplyView(placement: .timeline,
|
||||
timelineItemReplyDetails: .loaded(sender: .init(id: "", displayName: "Alice"),
|
||||
eventID: "123",
|
||||
|
||||
@@ -374,19 +374,27 @@ struct TimelineItemBubbledStylerView_Previews: PreviewProvider, TestablePreview
|
||||
static var previews: some View {
|
||||
mockTimeline
|
||||
.previewDisplayName("Mock Timeline")
|
||||
.previewLayout(.fixed(width: 390, height: 900))
|
||||
.padding(.bottom, 20)
|
||||
mockTimeline
|
||||
.environment(\.layoutDirection, .rightToLeft)
|
||||
.previewDisplayName("Mock Timeline RTL")
|
||||
.previewLayout(.fixed(width: 390, height: 900))
|
||||
.padding(.bottom, 20)
|
||||
replies
|
||||
.previewDisplayName("Replies")
|
||||
threads
|
||||
.previewDisplayName("Thread decorator")
|
||||
.snapshotPreferences(delay: 1)
|
||||
.previewLayout(.fixed(width: 390, height: 1700))
|
||||
.padding(.bottom, 20)
|
||||
encryptionAuthenticity
|
||||
.previewDisplayName("Encryption Indicators")
|
||||
pinned
|
||||
.previewDisplayName("Pinned messages")
|
||||
.snapshotPreferences(delay: 1)
|
||||
.previewLayout(.fixed(width: 390, height: 1150))
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
|
||||
static var mockTimeline: some View {
|
||||
|
||||
+31
-54
@@ -74,61 +74,38 @@ struct ImageRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = TimelineViewModel.mock
|
||||
|
||||
static var previews: some View {
|
||||
body
|
||||
.environmentObject(viewModel.context)
|
||||
.environment(\.timelineContext, viewModel.context)
|
||||
ScrollView {
|
||||
VStack(spacing: 20.0) {
|
||||
ImageRoomTimelineView(timelineItem: makeTimelineItem())
|
||||
ImageRoomTimelineView(timelineItem: makeTimelineItem(isEdited: true))
|
||||
|
||||
// Blur hashed item?
|
||||
|
||||
ImageRoomTimelineView(timelineItem: makeTimelineItem(caption: "This is a great image 😎"))
|
||||
ImageRoomTimelineView(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: 1200))
|
||||
.padding(.bottom, 20)
|
||||
}
|
||||
|
||||
static var body: some View {
|
||||
VStack(spacing: 20.0) {
|
||||
ImageRoomTimelineView(timelineItem: ImageRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "image.jpg",
|
||||
imageInfo: .mockImage,
|
||||
thumbnailInfo: nil)))
|
||||
|
||||
ImageRoomTimelineView(timelineItem: ImageRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "other.png",
|
||||
imageInfo: .mockImage,
|
||||
thumbnailInfo: nil)))
|
||||
|
||||
ImageRoomTimelineView(timelineItem: ImageRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "Blurhashed.jpg",
|
||||
imageInfo: .mockImage,
|
||||
thumbnailInfo: nil,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW",
|
||||
contentType: .gif)))
|
||||
|
||||
ImageRoomTimelineView(timelineItem: ImageRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "Blurhashed.jpg",
|
||||
caption: "This is a great image 😎",
|
||||
imageInfo: .mockImage,
|
||||
thumbnailInfo: .mockThumbnail,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW",
|
||||
contentType: .gif)))
|
||||
}
|
||||
private static func makeTimelineItem(caption: String? = nil, isEdited: Bool = false) -> ImageRoomTimelineItem {
|
||||
ImageRoomTimelineItem(id: .randomEvent,
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
isThreaded: false,
|
||||
sender: .init(id: "Bob"),
|
||||
content: .init(filename: "image.jpg",
|
||||
caption: caption,
|
||||
imageInfo: .mockImage,
|
||||
thumbnailInfo: .mockThumbnail,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW",
|
||||
contentType: .jpeg),
|
||||
properties: .init(isEdited: isEdited))
|
||||
}
|
||||
}
|
||||
|
||||
+2
-15
@@ -41,12 +41,6 @@ struct StickerRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
static let viewModel = TimelineViewModel.mock
|
||||
|
||||
static var previews: some View {
|
||||
body
|
||||
.environmentObject(viewModel.context)
|
||||
.environment(\.timelineContext, viewModel.context)
|
||||
}
|
||||
|
||||
static var body: some View {
|
||||
VStack(spacing: 20.0) {
|
||||
StickerRoomTimelineView(timelineItem: StickerRoomTimelineItem(id: .randomEvent,
|
||||
body: "Some image",
|
||||
@@ -57,15 +51,6 @@ struct StickerRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
sender: .init(id: "Bob"),
|
||||
imageInfo: .mockImage))
|
||||
|
||||
StickerRoomTimelineView(timelineItem: StickerRoomTimelineItem(id: .randomEvent,
|
||||
body: "Some other image",
|
||||
timestamp: "Now",
|
||||
isOutgoing: false,
|
||||
isEditable: false,
|
||||
canBeRepliedTo: true,
|
||||
sender: .init(id: "Bob"),
|
||||
imageInfo: .mockImage))
|
||||
|
||||
StickerRoomTimelineView(timelineItem: StickerRoomTimelineItem(id: .randomEvent,
|
||||
body: "Blurhashed image",
|
||||
timestamp: "Now",
|
||||
@@ -76,5 +61,7 @@ struct StickerRoomTimelineView_Previews: PreviewProvider, TestablePreview {
|
||||
imageInfo: .mockImage,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW"))
|
||||
}
|
||||
.environmentObject(viewModel.context)
|
||||
.environment(\.timelineContext, viewModel.context)
|
||||
}
|
||||
}
|
||||
|
||||
+31
-50
@@ -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))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -349,7 +349,7 @@ private extension VideoRoomTimelineItem {
|
||||
content: .init(filename: "video.mp4",
|
||||
caption: caption,
|
||||
videoInfo: .mockVideo,
|
||||
thumbnailInfo: .mockThumbnail,
|
||||
thumbnailInfo: .mockVideoThumbnail,
|
||||
blurhash: "KtI~70X5V?yss9oyrYs:t6"))
|
||||
}
|
||||
}
|
||||
|
||||
@@ -284,33 +284,35 @@ struct ImageInfoProxy: Hashable {
|
||||
|
||||
// MARK: - Mocks
|
||||
|
||||
private init(source: MediaSourceProxy, size: CGSize?, aspectRatio: CGFloat?, mimeType: String?) {
|
||||
private init(source: MediaSourceProxy, size: CGSize?, aspectRatio: CGFloat?) {
|
||||
self.source = source
|
||||
self.size = size
|
||||
self.aspectRatio = aspectRatio
|
||||
self.mimeType = mimeType
|
||||
mimeType = source.mimeType
|
||||
}
|
||||
|
||||
static var mockImage: ImageInfoProxy {
|
||||
guard let mediaSource = try? MediaSourceProxy(url: .mockMXCImage, mimeType: "image/png") else {
|
||||
guard let mediaSource = try? MediaSourceProxy(url: .mockMXCImage, mimeType: "image/jpg") else {
|
||||
fatalError("Invalid mock media source URL")
|
||||
}
|
||||
|
||||
return .init(source: mediaSource,
|
||||
size: .init(width: 100, height: 100),
|
||||
aspectRatio: 1,
|
||||
mimeType: "image/png")
|
||||
return .init(source: mediaSource, size: .init(width: 2730, height: 2048), aspectRatio: 4 / 3)
|
||||
}
|
||||
|
||||
static var mockThumbnail: ImageInfoProxy {
|
||||
guard let mediaSource = try? MediaSourceProxy(url: .mockMXCImage, mimeType: "image/png") else {
|
||||
guard let mediaSource = try? MediaSourceProxy(url: .mockMXCImage, mimeType: "image/jpg") else {
|
||||
fatalError("Invalid mock media source URL")
|
||||
}
|
||||
|
||||
return .init(source: mediaSource,
|
||||
size: nil,
|
||||
aspectRatio: nil,
|
||||
mimeType: nil)
|
||||
return .init(source: mediaSource, size: .init(width: 800, height: 600), aspectRatio: 4 / 3)
|
||||
}
|
||||
|
||||
static var mockVideoThumbnail: ImageInfoProxy {
|
||||
guard let mediaSource = try? MediaSourceProxy(url: .mockMXCVideo, mimeType: "image/jpg") else {
|
||||
fatalError("Invalid mock media source URL")
|
||||
}
|
||||
|
||||
return .init(source: mediaSource, size: .init(width: 800, height: 450), aspectRatio: 16 / 9)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user