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