mirror of
https://github.com/yattee/yattee.git
synced 2025-08-06 10:44:06 +00:00
Add overlay model visibility methods
This commit is contained in:
@@ -3,8 +3,9 @@ import Foundation
|
||||
import SwiftUI
|
||||
|
||||
final class ControlOverlaysModel: ObservableObject {
|
||||
static let animation = Animation.easeInOut(duration: 0.2)
|
||||
static let shared = ControlOverlaysModel()
|
||||
@Published var presenting = false { didSet { handlePresentationChange() } }
|
||||
@Published private(set) var presenting = false { didSet { handlePresentationChange() } }
|
||||
|
||||
private lazy var controls = PlayerControlsModel.shared
|
||||
private lazy var player: PlayerModel! = PlayerModel.shared
|
||||
@@ -14,6 +15,16 @@ final class ControlOverlaysModel: ObservableObject {
|
||||
controls.objectWillChange.send()
|
||||
}
|
||||
|
||||
func hide() {
|
||||
presenting = false
|
||||
controls.objectWillChange.send()
|
||||
}
|
||||
|
||||
func show() {
|
||||
presenting = true
|
||||
controls.objectWillChange.send()
|
||||
}
|
||||
|
||||
private func handlePresentationChange() {
|
||||
guard let player else { return }
|
||||
player.backend.setNeedsNetworkStateUpdates(presenting && Defaults[.showMPVPlaybackStats])
|
||||
|
@@ -70,7 +70,7 @@ final class PlayerControlsModel: ObservableObject {
|
||||
|
||||
func hideOverlays() {
|
||||
presentingDetailsOverlay = false
|
||||
controlsOverlayModel.presenting = false
|
||||
controlsOverlayModel.hide()
|
||||
}
|
||||
|
||||
func show() {
|
||||
|
Reference in New Issue
Block a user