2022-09-01 23:05:31 +00:00
|
|
|
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() {
|
2022-09-28 14:27:01 +00:00
|
|
|
guard let player else { return }
|
2022-09-01 23:05:31 +00:00
|
|
|
player.backend.setNeedsNetworkStateUpdates(presenting && Defaults[.showMPVPlaybackStats])
|
|
|
|
}
|
|
|
|
}
|