Add options for history: badge color and reset watched status on playing

This commit is contained in:
Arkadiusz Fal
2022-01-02 20:39:19 +01:00
parent 117057dd0e
commit e29982454b
9 changed files with 135 additions and 9 deletions

View File

@@ -1,5 +1,6 @@
import CoreData
import CoreMedia
import Defaults
import Foundation
extension PlayerModel {
@@ -42,6 +43,10 @@ extension PlayerModel {
watch.videoID = id
} else {
watch = results?.first
if !Defaults[.resetWatchedStatusOnPlaying], watch.finished {
return
}
}
if let seconds = playerItemDuration?.seconds {

View File

@@ -24,6 +24,11 @@ extension Watch {
}
let progress = (stoppedAt / videoDuration) * 100
if progress >= Double(watchedThreshold) {
return 100
}
return min(max(progress, 0), 100)
}