Add buttons for hiding watched videos

Fix #448
This commit is contained in:
Arkadiusz Fal
2023-05-23 18:48:39 +02:00
parent 1e2d6cf72f
commit eed9330c0c
14 changed files with 100 additions and 22 deletions

View File

@@ -7,22 +7,17 @@ struct PlayerQueueRow: View {
let item: PlayerQueueItem
var history = false
var autoplay = false
var watch: Watch?
private var player = PlayerModel.shared
@Default(.closePiPOnNavigation) var closePiPOnNavigation
@FetchRequest private var watchRequest: FetchedResults<Watch>
init(item: PlayerQueueItem, history: Bool = false, autoplay: Bool = false) {
init(item: PlayerQueueItem, history: Bool = false, autoplay: Bool = false, watch: Watch? = nil) {
self.item = item
self.history = history
self.autoplay = autoplay
_watchRequest = FetchRequest<Watch>(
entity: Watch.entity(),
sortDescriptors: [],
predicate: NSPredicate(format: "videoID = %@", item.videoID)
)
self.watch = watch
}
var body: some View {
@@ -80,10 +75,6 @@ struct PlayerQueueRow: View {
#endif
}
private var watch: Watch? {
watchRequest.first
}
private var watchStoppedAt: CMTime? {
guard let seconds = watch?.stoppedAt else {
return nil