Fixes #2058 - Prevent QuickLook from breaking media uploading on Mac, replace the preview with a plain filename label

This commit is contained in:
Stefan Ceriu 2023-11-13 13:21:24 +02:00 committed by Stefan Ceriu
parent 0e6e8a5892
commit 2e1b4cb80b
2 changed files with 19 additions and 5 deletions

View File

@ -25,9 +25,7 @@ struct MediaUploadPreviewScreen: View {
}
var body: some View {
PreviewView(context: context,
fileURL: context.viewState.url,
title: context.viewState.title)
mainContent
.id(UUID())
.navigationTitle(title)
.navigationBarTitleDisplayMode(.inline)
@ -37,6 +35,19 @@ struct MediaUploadPreviewScreen: View {
.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
private var toolbar: some ToolbarContent {
ToolbarItem(placement: .cancellationAction) {
@ -117,10 +128,12 @@ struct MediaUploadPreviewScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = MediaUploadPreviewScreenViewModel(userIndicatorController: UserIndicatorControllerMock.default,
roomProxy: RoomProxyMock(),
mediaUploadingPreprocessor: MediaUploadingPreprocessor(),
title: nil,
title: "some random file name",
url: URL.picturesDirectory)
static var previews: some View {
MediaUploadPreviewScreen(context: viewModel.context)
NavigationStack {
MediaUploadPreviewScreen(context: viewModel.context)
}
}
}

1
changelog.d/2058.bugfix Normal file
View File

@ -0,0 +1 @@
Prevent QuickLook from breaking media uploading on Mac, replace the preview with a plain filename label