mirror of
https://github.com/yattee/yattee.git
synced 2025-08-09 20:24:06 +00:00
Fix updating watch history
This commit is contained in:
@@ -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
|
||||
|
@@ -58,7 +58,7 @@ extension Watch {
|
||||
|
||||
var progress: Double {
|
||||
guard videoDuration.isFinite, !videoDuration.isZero else {
|
||||
return 0
|
||||
return 100
|
||||
}
|
||||
|
||||
let progress = (stoppedAt / videoDuration) * 100
|
||||
|
Reference in New Issue
Block a user