mirror of
https://github.com/yattee/yattee.git
synced 2024-11-10 00:08:21 +00:00
22 lines
652 B
Swift
22 lines
652 B
Swift
import Defaults
|
|
import Foundation
|
|
import SwiftUI
|
|
|
|
final class ControlOverlaysModel: ObservableObject {
|
|
static let shared = ControlOverlaysModel()
|
|
@Published var presenting = false { didSet { handlePresentationChange() } }
|
|
|
|
private lazy var controls = PlayerControlsModel.shared
|
|
private lazy var player: PlayerModel! = PlayerModel.shared
|
|
|
|
func toggle() {
|
|
presenting.toggle()
|
|
controls.objectWillChange.send()
|
|
}
|
|
|
|
private func handlePresentationChange() {
|
|
guard let player = player else { return }
|
|
player.backend.setNeedsNetworkStateUpdates(presenting && Defaults[.showMPVPlaybackStats])
|
|
}
|
|
}
|