Fix updating watch history

This commit is contained in:
Arkadiusz Fal
2022-12-15 22:39:42 +01:00
parent 12005e63e1
commit 404e2e6768
3 changed files with 72 additions and 3 deletions

View File

@@ -48,6 +48,10 @@ extension PlayerModel {
let id = currentVideo.videoID
let time = backend.currentTime
let seconds = time?.seconds ?? 0
let duration = playerTime.duration.seconds
if seconds < 3 {
return
}
let watchFetchRequest = Watch.fetchRequest()
watchFetchRequest.predicate = NSPredicate(format: "videoID = %@", id as String)
@@ -64,8 +68,6 @@ extension PlayerModel {
let duration = self.playerTime.duration.seconds
if results?.isEmpty ?? true {
if seconds < 3, duration > 3 { return }
watch = Watch(context: self.backgroundContext)
watch.videoID = id
watch.appName = currentVideo.app.rawValue

View File

@@ -58,7 +58,7 @@ extension Watch {
var progress: Double {
guard videoDuration.isFinite, !videoDuration.isZero else {
return 0
return 100
}
let progress = (stoppedAt / videoDuration) * 100