From 532e7133228baa38111e59428e5bd5688f0de662 Mon Sep 17 00:00:00 2001 From: Arkadiusz Fal Date: Thu, 22 Oct 2026 07:14:32 +0200 Subject: [PATCH] Keep the separate macOS player window open when opening a link --- Yattee/Core/AppEnvironment.swift | 3 +++ .../Navigation/NavigationCoordinator.swift | 21 ++++++++++++++++++- 2 files changed, 23 insertions(+), 1 deletion(-) diff --git a/Yattee/Core/AppEnvironment.swift b/Yattee/Core/AppEnvironment.swift index e402d12d..ff5875b1 100644 --- a/Yattee/Core/AppEnvironment.swift +++ b/Yattee/Core/AppEnvironment.swift @@ -412,6 +412,9 @@ final class AppEnvironment { // Wire up media services to player player.setMediaSourcesManager(mediaSources) self.navigationCoordinator.setMediaSourcesManager(mediaSources) + #if os(macOS) + self.navigationCoordinator.setSettingsManager(settings) + #endif player.setSMBClient(self.smbClient) player.setWebDAVClient(self.webDAVClient) player.setLocalFileClient(self.localFileClient) diff --git a/Yattee/Services/Navigation/NavigationCoordinator.swift b/Yattee/Services/Navigation/NavigationCoordinator.swift index 44c00334..5995d9ae 100644 --- a/Yattee/Services/Navigation/NavigationCoordinator.swift +++ b/Yattee/Services/Navigation/NavigationCoordinator.swift @@ -251,6 +251,11 @@ final class NavigationCoordinator { /// Reference to MediaSourcesManager for navigating to media source directories. private weak var mediaSourcesManager: MediaSourcesManager? + #if os(macOS) + /// Reference to SettingsManager for the player window mode. + private weak var settingsManager: SettingsManager? + #endif + // MARK: - Handoff Integration /// Set the HandoffManager reference for activity updates. @@ -263,6 +268,13 @@ final class NavigationCoordinator { self.mediaSourcesManager = manager } + #if os(macOS) + /// Set the SettingsManager reference for the player window mode. + func setSettingsManager(_ manager: SettingsManager) { + self.settingsManager = manager + } + #endif + // MARK: - Navigation Actions /// Navigate to a destination by pushing it onto the selected section's stack. @@ -331,8 +343,15 @@ final class NavigationCoordinator { /// Navigate to an opened link's screen, collapsing the full-screen player /// so the pushed screen is visible instead of landing underneath it. + /// A macOS player in its own window doesn't cover the main window, so it + /// stays open. func navigateToOpenedLink(_ destination: NavigationDestination) { - if isPlayerExpanded { + #if os(macOS) + let coversMainWindow = settingsManager?.macPlayerSeparateWindow != true + #else + let coversMainWindow = true + #endif + if isPlayerExpanded, coversMainWindow { isPlayerCollapsing = true isPlayerExpanded = false }