mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 16:10:20 +00:00
Fixes #2058 - Prevent QuickLook from breaking media uploading on Mac, replace the preview with a plain filename label
This commit is contained in:
committed by
Stefan Ceriu
parent
0e6e8a5892
commit
2e1b4cb80b
+17
-4
@@ -25,9 +25,7 @@ struct MediaUploadPreviewScreen: View {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var body: some View {
|
var body: some View {
|
||||||
PreviewView(context: context,
|
mainContent
|
||||||
fileURL: context.viewState.url,
|
|
||||||
title: context.viewState.title)
|
|
||||||
.id(UUID())
|
.id(UUID())
|
||||||
.navigationTitle(title)
|
.navigationTitle(title)
|
||||||
.navigationBarTitleDisplayMode(.inline)
|
.navigationBarTitleDisplayMode(.inline)
|
||||||
@@ -37,6 +35,19 @@ struct MediaUploadPreviewScreen: View {
|
|||||||
.interactiveDismissDisabled()
|
.interactiveDismissDisabled()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ViewBuilder
|
||||||
|
private var mainContent: some View {
|
||||||
|
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||||
|
Text(title)
|
||||||
|
.font(.compound.headingMD)
|
||||||
|
.foregroundColor(.compound.textSecondary)
|
||||||
|
} else {
|
||||||
|
PreviewView(context: context,
|
||||||
|
fileURL: context.viewState.url,
|
||||||
|
title: context.viewState.title)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@ToolbarContentBuilder
|
@ToolbarContentBuilder
|
||||||
private var toolbar: some ToolbarContent {
|
private var toolbar: some ToolbarContent {
|
||||||
ToolbarItem(placement: .cancellationAction) {
|
ToolbarItem(placement: .cancellationAction) {
|
||||||
@@ -117,11 +128,13 @@ struct MediaUploadPreviewScreen_Previews: PreviewProvider, TestablePreview {
|
|||||||
static let viewModel = MediaUploadPreviewScreenViewModel(userIndicatorController: UserIndicatorControllerMock.default,
|
static let viewModel = MediaUploadPreviewScreenViewModel(userIndicatorController: UserIndicatorControllerMock.default,
|
||||||
roomProxy: RoomProxyMock(),
|
roomProxy: RoomProxyMock(),
|
||||||
mediaUploadingPreprocessor: MediaUploadingPreprocessor(),
|
mediaUploadingPreprocessor: MediaUploadingPreprocessor(),
|
||||||
title: nil,
|
title: "some random file name",
|
||||||
url: URL.picturesDirectory)
|
url: URL.picturesDirectory)
|
||||||
static var previews: some View {
|
static var previews: some View {
|
||||||
|
NavigationStack {
|
||||||
MediaUploadPreviewScreen(context: viewModel.context)
|
MediaUploadPreviewScreen(context: viewModel.context)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PreviewViewController: QLPreviewController {
|
private class PreviewViewController: QLPreviewController {
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
Prevent QuickLook from breaking media uploading on Mac, replace the preview with a plain filename label
|
||||||
Reference in New Issue
Block a user