Keep the separate macOS player window open when opening a link

This commit is contained in:
Arkadiusz Fal
2026-10-22 07:14:32 +02:00
parent 983e7679a9
commit 532e713322
2 changed files with 23 additions and 1 deletions

View File

@@ -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)

View File

@@ -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
}