mirror of
https://github.com/yattee/yattee.git
synced 2024-12-24 22:43:41 +00:00
Don't draw player when in background
This commit is contained in:
parent
9d79543085
commit
b90a726f87
@ -446,6 +446,8 @@ final class PlayerModel: ObservableObject {
|
|||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
func handleEnterForeground() {
|
func handleEnterForeground() {
|
||||||
|
setNeedsDrawing(true)
|
||||||
|
|
||||||
guard closePiPAndOpenPlayerOnEnteringForeground, playingInPictureInPicture else {
|
guard closePiPAndOpenPlayerOnEnteringForeground, playingInPictureInPicture else {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
@ -454,6 +456,10 @@ final class PlayerModel: ObservableObject {
|
|||||||
closePiP()
|
closePiP()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func handleEnterBackground() {
|
||||||
|
setNeedsDrawing(false)
|
||||||
|
}
|
||||||
|
|
||||||
func enterFullScreen() {
|
func enterFullScreen() {
|
||||||
guard !controls.playingFullscreen else {
|
guard !controls.playingFullscreen else {
|
||||||
return
|
return
|
||||||
|
@ -61,6 +61,11 @@ struct YatteeApp: App {
|
|||||||
) { _ in
|
) { _ in
|
||||||
player.handleEnterForeground()
|
player.handleEnterForeground()
|
||||||
}
|
}
|
||||||
|
.onReceive(
|
||||||
|
NotificationCenter.default.publisher(for: UIApplication.didEnterBackgroundNotification)
|
||||||
|
) { _ in
|
||||||
|
player.handleEnterBackground()
|
||||||
|
}
|
||||||
#endif
|
#endif
|
||||||
#if os(iOS)
|
#if os(iOS)
|
||||||
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
.handlesExternalEvents(preferring: Set(["*"]), allowing: Set(["*"]))
|
||||||
|
Loading…
Reference in New Issue
Block a user