From e6df9c703858e71c26ea8e2a773d743a8c68c5bf Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 10 Sep 2023 12:27:55 +0200 Subject: [PATCH] fix: video upload date not saved to watch history --- app/src/main/java/com/github/libretube/api/obj/Streams.kt | 3 ++- .../main/java/com/github/libretube/db/DatabaseHelper.kt | 7 ++++--- .../com/github/libretube/services/OnlinePlayerService.kt | 1 + 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/github/libretube/api/obj/Streams.kt b/app/src/main/java/com/github/libretube/api/obj/Streams.kt index 2b5ae093f..78169e662 100644 --- a/app/src/main/java/com/github/libretube/api/obj/Streams.kt +++ b/app/src/main/java/com/github/libretube/api/obj/Streams.kt @@ -2,6 +2,7 @@ package com.github.libretube.api.obj import com.github.libretube.db.obj.DownloadItem import com.github.libretube.enums.FileType +import com.github.libretube.extensions.toMillis import com.github.libretube.helpers.ProxyHelper import com.github.libretube.parcelable.DownloadData import kotlin.io.path.Path @@ -84,7 +85,7 @@ data class Streams( uploaderUrl = uploaderUrl, uploaderAvatar = uploaderAvatar, uploadedDate = uploadDate.toString(), - uploaded = null, + uploaded = uploadDate.toMillis(), duration = duration, views = views, uploaderVerified = uploaderVerified, diff --git a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt index 2497c2962..db8d052cb 100644 --- a/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt +++ b/app/src/main/java/com/github/libretube/db/DatabaseHelper.kt @@ -29,9 +29,10 @@ object DatabaseHelper { videoId, stream.title, stream.uploaded?.let { - Instant.ofEpochMilli( - it - ).atZone(ZoneId.systemDefault()).toLocalDate().toKotlinLocalDate() + Instant.ofEpochMilli(it) + .atZone(ZoneId.systemDefault()) + .toLocalDate() + .toKotlinLocalDate() }, stream.uploaderName, stream.uploaderUrl?.toID(), diff --git a/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt b/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt index 66edd1e43..011542ded 100644 --- a/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt +++ b/app/src/main/java/com/github/libretube/services/OnlinePlayerService.kt @@ -27,6 +27,7 @@ import com.github.libretube.api.obj.Streams import com.github.libretube.constants.IntentData import com.github.libretube.constants.PLAYER_CHANNEL_ID import com.github.libretube.constants.PLAYER_NOTIFICATION_ID +import com.github.libretube.db.DatabaseHelper import com.github.libretube.db.DatabaseHolder.Database import com.github.libretube.db.obj.WatchPosition import com.github.libretube.extensions.parcelableExtra