mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-04 01:20:12 +00:00
Move media file loading logic to the SDK. (#702)
* Adopt getMediaFile for media previewing.
This commit is contained in:
@@ -56,8 +56,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
switch action {
|
||||
case .displayRoomDetails:
|
||||
self.displayRoomDetails()
|
||||
case .displayVideo(let fileURL, let title), .displayFile(let fileURL, let title):
|
||||
self.displayFile(for: fileURL, with: title)
|
||||
case .displayMediaFile(let file, let title):
|
||||
self.displayFilePreview(for: file, with: title)
|
||||
case .displayEmojiPicker(let itemId):
|
||||
self.displayEmojiPickerScreen(for: itemId)
|
||||
case .displayReportContent(let itemId):
|
||||
@@ -77,8 +77,8 @@ final class RoomScreenCoordinator: CoordinatorProtocol {
|
||||
|
||||
// MARK: - Private
|
||||
|
||||
private func displayFile(for fileURL: URL, with title: String?) {
|
||||
let params = FilePreviewCoordinatorParameters(fileURL: fileURL, title: title)
|
||||
private func displayFilePreview(for file: MediaFileHandleProxy, with title: String?) {
|
||||
let params = FilePreviewCoordinatorParameters(mediaFile: file, title: title)
|
||||
let coordinator = FilePreviewCoordinator(parameters: params)
|
||||
coordinator.callback = { [weak self] _ in
|
||||
self?.navigationStackCoordinator.pop()
|
||||
|
||||
@@ -20,8 +20,7 @@ import UIKit
|
||||
|
||||
enum RoomScreenViewModelAction {
|
||||
case displayRoomDetails
|
||||
case displayVideo(videoURL: URL, title: String?)
|
||||
case displayFile(fileURL: URL, title: String?)
|
||||
case displayMediaFile(file: MediaFileHandleProxy, title: String?)
|
||||
case displayEmojiPicker(itemId: String)
|
||||
case displayReportContent(itemId: String)
|
||||
}
|
||||
|
||||
@@ -134,10 +134,8 @@ class RoomScreenViewModel: RoomScreenViewModelType, RoomScreenViewModelProtocol
|
||||
let action = await timelineController.processItemTap(itemId)
|
||||
|
||||
switch action {
|
||||
case .displayVideo(let videoURL, let title):
|
||||
callback?(.displayVideo(videoURL: videoURL, title: title))
|
||||
case .displayFile(let fileURL, let title):
|
||||
callback?(.displayFile(fileURL: fileURL, title: title))
|
||||
case .displayMediaFile(let file, let title):
|
||||
callback?(.displayMediaFile(file: file, title: title))
|
||||
case .none:
|
||||
break
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ struct ImageRoomTimelineView: View {
|
||||
|
||||
@ViewBuilder
|
||||
var overlay: some View {
|
||||
if timelineItem.type == .gif {
|
||||
if timelineItem.contentType == .gif {
|
||||
Text(ElementL10n.roomTimelineImageGif)
|
||||
.font(.element.bodyBold)
|
||||
.foregroundStyle(.primary)
|
||||
@@ -96,7 +96,7 @@ struct ImageRoomTimelineView_Previews: PreviewProvider {
|
||||
source: nil,
|
||||
aspectRatio: 0.7,
|
||||
blurhash: "L%KUc%kqS$RP?Ks,WEf8OlrqaekW",
|
||||
type: .gif))
|
||||
contentType: .gif))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user