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

@@ -6,6 +6,7 @@ import SwiftUI
struct VideoCell: View {
var id: String?
private var video: Video
private var watch: Watch?
@Environment(\.horizontalCells) private var horizontalCells
@Environment(\.inChannelView) private var inChannelView
@@ -27,12 +28,10 @@ struct VideoCell: View {
private var navigation: NavigationModel { .shared }
private var player: PlayerModel { .shared }
@FetchRequest private var watchRequest: FetchedResults<Watch>
init(id: String? = nil, video: Video) {
init(id: String? = nil, video: Video, watch: Watch? = nil) {
self.id = id
self.video = video
_watchRequest = video.watchFetchRequest
self.watch = watch
}
var body: some View {
@@ -107,10 +106,6 @@ struct VideoCell: View {
watchedVideoPlayNowBehavior == .continue
}
private var watch: Watch? {
watchRequest.first
}
private var finished: Bool {
watch?.finished ?? false
}