From 3f0f4429373a4a45d099180f892aa49d5964afad Mon Sep 17 00:00:00 2001 From: Doug <6060466+pixlwave@users.noreply.github.com> Date: Tue, 26 Nov 2024 14:23:20 +0000 Subject: [PATCH] Fix the presentation of QuickLook when viewing logs on macOS. (#3556) --- .../BugReportFlowCoordinator.swift | 15 +++++++++++++-- .../LogViewerScreen/View/LogViewerScreen.swift | 6 +----- 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift b/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift index 04a37713d..efc6b0b33 100644 --- a/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift +++ b/ElementX/Sources/FlowCoordinators/BugReportFlowCoordinator.swift @@ -6,6 +6,7 @@ // import Combine +import Foundation struct BugReportFlowCoordinatorParameters { enum PresentationMode { @@ -93,12 +94,22 @@ class BugReportFlowCoordinator: FlowCoordinatorProtocol { switch action { case .done: - internalNavigationStackCoordinator?.pop() + if ProcessInfo.processInfo.isiOSAppOnMac { + internalNavigationStackCoordinator?.setSheetCoordinator(nil) + } else { + internalNavigationStackCoordinator?.pop() + } } } .store(in: &cancellables) - internalNavigationStackCoordinator?.push(coordinator) + if ProcessInfo.processInfo.isiOSAppOnMac { + // On macOS the QuickLook is a separate window, closing a pushed QuickLook + // controller closes the whole Settings sheet so lets add another one. + internalNavigationStackCoordinator?.setSheetCoordinator(coordinator) + } else { + internalNavigationStackCoordinator?.push(coordinator) + } } private func dismiss() { diff --git a/ElementX/Sources/Screens/LogViewerScreen/View/LogViewerScreen.swift b/ElementX/Sources/Screens/LogViewerScreen/View/LogViewerScreen.swift index cdb9cace9..c401dc2e4 100644 --- a/ElementX/Sources/Screens/LogViewerScreen/View/LogViewerScreen.swift +++ b/ElementX/Sources/Screens/LogViewerScreen/View/LogViewerScreen.swift @@ -25,11 +25,7 @@ private struct PreviewView: UIViewControllerRepresentable { previewController.dataSource = context.coordinator previewController.delegate = context.coordinator - if ProcessInfo.processInfo.isiOSAppOnMac { - return previewController - } else { - return UINavigationController(rootViewController: previewController) - } + return UINavigationController(rootViewController: previewController) } func updateUIViewController(_ uiViewController: UIViewController, context: Context) { }