2022-09-02 04:35:31 +05:30
|
|
|
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 19:57:01 +05:30
|
|
|
guard let player else { return }
|
2022-09-02 04:35:31 +05:30
|
|
|
player.backend.setNeedsNetworkStateUpdates(presenting && Defaults[.showMPVPlaybackStats])
|
|
|
|
}
|
|
|
|
}
|