mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Tweaks for macOS (#1383)
* Fix constant Create Room button animation on macOS. * Allow right-clicking on timeline items to work again on macOS. * Use inline media upload previews on macOS This comes with the caveat that the previews are no longer interactive.
This commit is contained in:
+15
-5
@@ -20,13 +20,19 @@ import SwiftUI
|
||||
struct MediaUploadPreviewScreen: View {
|
||||
@ObservedObject var context: MediaUploadPreviewScreenViewModel.Context
|
||||
|
||||
var title: String {
|
||||
ProcessInfo.processInfo.isiOSAppOnMac ? context.viewState.title ?? "" : ""
|
||||
}
|
||||
|
||||
var body: some View {
|
||||
PreviewView(context: context,
|
||||
fileURL: context.viewState.url,
|
||||
title: context.viewState.title)
|
||||
.id(UUID())
|
||||
.navigationTitle(title)
|
||||
.navigationBarTitleDisplayMode(.inline)
|
||||
.disabled(context.viewState.shouldDisableInteraction)
|
||||
.ignoresSafeArea(edges: .bottom)
|
||||
.ignoresSafeArea(edges: [.horizontal, .bottom])
|
||||
.toolbar { toolbar }
|
||||
.interactiveDismissDisabled()
|
||||
}
|
||||
@@ -52,15 +58,19 @@ private struct PreviewView: UIViewControllerRepresentable {
|
||||
let fileURL: URL
|
||||
let title: String?
|
||||
|
||||
func makeUIViewController(context: Context) -> UINavigationController {
|
||||
func makeUIViewController(context: Context) -> UIViewController {
|
||||
let previewController = QLPreviewController()
|
||||
previewController.dataSource = context.coordinator
|
||||
previewController.delegate = context.coordinator
|
||||
|
||||
return UINavigationController(rootViewController: previewController)
|
||||
|
||||
if ProcessInfo.processInfo.isiOSAppOnMac {
|
||||
return previewController
|
||||
} else {
|
||||
return UINavigationController(rootViewController: previewController)
|
||||
}
|
||||
}
|
||||
|
||||
func updateUIViewController(_ uiViewController: UINavigationController, context: Context) { }
|
||||
func updateUIViewController(_ uiViewController: UIViewController, context: Context) { }
|
||||
|
||||
func makeCoordinator() -> Coordinator {
|
||||
Coordinator(view: self)
|
||||
|
||||
Reference in New Issue
Block a user