From df95931d0ade28f8ef1784864266d8e4d0e5c02f Mon Sep 17 00:00:00 2001 From: Blatzar <46196380+Blatzar@users.noreply.github.com> Date: Sat, 28 Jan 2023 23:36:24 +0100 Subject: [PATCH] future proofed SyncID --- .../com/lagradost/cloudstream3/syncproviders/SyncAPI.kt | 6 +++++- .../cloudstream3/syncproviders/providers/LocalList.kt | 2 +- .../com/lagradost/cloudstream3/utils/DataStoreHelper.kt | 6 +++--- 3 files changed, 9 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt index 2f5e0050..8c76c5bf 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/SyncAPI.kt @@ -138,7 +138,11 @@ interface SyncAPI : OAuth2API { data class LibraryItem( override val name: String, override val url: String, - /** Unique unchanging string used for data storage */ + /** + * Unique unchanging string used for data storage. + * This should be the actual id when you change scores and status + * since score changes from library might get added in the future. + **/ val syncId: String, val episodesCompleted: Int?, val episodesTotal: Int?, diff --git a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt index 61e9e294..0b081220 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/syncproviders/providers/LocalList.kt @@ -72,7 +72,7 @@ class LocalList : SyncAPI { it.second.stringRes }.mapValues { group -> group.value.mapNotNull { - getBookmarkedData(it.first)?.toLibraryItem() + getBookmarkedData(it.first)?.toLibraryItem(it.first.toString()) } } } diff --git a/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt b/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt index 4e9c646f..281c9c44 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/utils/DataStoreHelper.kt @@ -55,16 +55,16 @@ object DataStoreHelper { @JsonProperty("quality") override var quality: SearchQuality? = null, @JsonProperty("posterHeaders") override var posterHeaders: Map? = null, ) : SearchResponse { - fun toLibraryItem(): SyncAPI.LibraryItem { + fun toLibraryItem(id: String): SyncAPI.LibraryItem { return SyncAPI.LibraryItem( name, url, - url, + id, null, null, null, null, - apiName, type, posterUrl, posterHeaders, quality, id + apiName, type, posterUrl, posterHeaders, quality, this.id ) } }