1
0
mirror of https://github.com/yattee/yattee.git synced 2024-12-14 06:10:32 +05:30

Minor fixes

This commit is contained in:
Arkadiusz Fal 2022-07-11 18:30:12 +02:00
parent d3336b3ae1
commit 607d2f9b83
2 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,6 @@
import Combine
import CoreMedia
import Defaults
import Foundation
import SwiftUI
@ -7,8 +8,8 @@ final class PlayerControlsModel: ObservableObject {
@Published var isLoadingVideo = false
@Published var isPlaying = true
@Published var presentingControls = false { didSet { handlePresentationChange() } }
@Published var presentingControlsOverlay = false { didSet { handleOverlayPresentationChange() } }
@Published var presentingDetailsOverlay = false
@Published var presentingControlsOverlay = false { didSet { handleSettingsOverlayPresentationChange() } }
@Published var presentingDetailsOverlay = false { didSet { handleDetailsOverlayPresentationChange() } }
@Published var timer: Timer?
#if os(tvOS)
@ -49,8 +50,8 @@ final class PlayerControlsModel: ObservableObject {
}
}
func handleOverlayPresentationChange() {
player?.backend.setNeedsNetworkStateUpdates(presentingControlsOverlay)
func handleSettingsOverlayPresentationChange() {
player?.backend.setNeedsNetworkStateUpdates(presentingControlsOverlay && Defaults[.showMPVPlaybackStats])
if presentingControlsOverlay {
removeTimer()
} else {
@ -58,6 +59,14 @@ final class PlayerControlsModel: ObservableObject {
}
}
func handleDetailsOverlayPresentationChange() {
if presentingDetailsOverlay {
removeTimer()
} else {
resetTimer()
}
}
var presentingOverlays: Bool {
presentingDetailsOverlay || presentingControlsOverlay
}

View File

@ -15,7 +15,11 @@ struct ControlsOverlay: View {
backendButtons
}
qualityButton
captionsButton
if player.activeBackend == .mpv {
captionsButton
}
HStack {
decreaseRateButton
rateButton