mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 04:04:07 +00:00
Improve windows handling on macOS
This commit is contained in:
@@ -14,7 +14,7 @@ struct OpenURLHandler {
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
guard url.host != OpenWindow.player.location else {
|
||||
guard url.host != Windows.player.location else {
|
||||
return
|
||||
}
|
||||
#endif
|
||||
@@ -28,7 +28,7 @@ struct OpenURLHandler {
|
||||
}
|
||||
|
||||
#if os(macOS)
|
||||
OpenWindow.main.open()
|
||||
Windows.main.open()
|
||||
#endif
|
||||
|
||||
accounts.api.video(id).load().onSuccess { response in
|
||||
|
@@ -47,12 +47,18 @@ struct YatteeApp: App {
|
||||
.environmentObject(thumbnails)
|
||||
.environmentObject(menu)
|
||||
.environmentObject(search)
|
||||
#if !os(macOS)
|
||||
.onReceive(
|
||||
NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)
|
||||
) { _ in
|
||||
player.handleEnterForeground()
|
||||
}
|
||||
#if os(macOS)
|
||||
.background(
|
||||
HostingWindowFinder { window in
|
||||
Windows.mainWindow = window
|
||||
}
|
||||
)
|
||||
#else
|
||||
.onReceive(
|
||||
NotificationCenter.default.publisher(for: UIApplication.willEnterForegroundNotification)
|
||||
) { _ in
|
||||
player.handleEnterForeground()
|
||||
}
|
||||
#endif
|
||||
#if os(iOS)
|
||||
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
||||
@@ -81,6 +87,11 @@ struct YatteeApp: App {
|
||||
#if os(macOS)
|
||||
WindowGroup(player.windowTitle) {
|
||||
VideoPlayerView()
|
||||
.background(
|
||||
HostingWindowFinder { window in
|
||||
Windows.playerWindow = window
|
||||
}
|
||||
)
|
||||
.onAppear { player.presentingPlayer = true }
|
||||
.onDisappear { player.presentingPlayer = false }
|
||||
.environment(\.managedObjectContext, persistenceController.container.viewContext)
|
||||
|
Reference in New Issue
Block a user