From 4b48a84ec9f78ae8f5df3f2db718334a6ec076b3 Mon Sep 17 00:00:00 2001 From: AntsyLich <59261191+AntsyLich@users.noreply.github.com> Date: Sun, 27 Sep 2026 23:09:32 +0600 Subject: [PATCH] Keep a stored track's remote entry when restoring Restoring over an existing track took the backup's remote id and library id but kept the stored url and title, pairing one remote entry's id with another's details. The stored track now wins like the rest of an entry's stored data, and the backup only moves its last chapter read forward. --- .../tachiyomi/data/backup/RestoreRepositoryImpl.kt | 13 ++----------- 1 file changed, 2 insertions(+), 11 deletions(-) diff --git a/data/src/main/java/tachiyomi/data/backup/RestoreRepositoryImpl.kt b/data/src/main/java/tachiyomi/data/backup/RestoreRepositoryImpl.kt index d4a4ac414..cf9dd19ab 100644 --- a/data/src/main/java/tachiyomi/data/backup/RestoreRepositoryImpl.kt +++ b/data/src/main/java/tachiyomi/data/backup/RestoreRepositoryImpl.kt @@ -257,17 +257,10 @@ class RestoreRepositoryImpl( mangaId = manga.id, ) - if (track.forComparison() == dbTrack.forComparison()) { - // Same state; skip - return@mapNotNull null - } + if (track.lastChapterRead <= dbTrack.lastChapterRead) return@mapNotNull null // Update to an existing track - dbTrack.copy( - remoteId = track.remoteId, - libraryId = track.libraryId, - lastChapterRead = max(dbTrack.lastChapterRead, track.lastChapterRead), - ) + dbTrack.copy(lastChapterRead = track.lastChapterRead) } .partition { it.id > 0 } @@ -295,8 +288,6 @@ class RestoreRepositoryImpl( } } - private fun Track.forComparison() = this.copy(id = 0L, mangaId = 0L) - private suspend fun restoreExcludedScanlators(manga: Manga, excludedScanlators: List) { if (excludedScanlators.isEmpty()) return val existingExcludedScanlators = database.excluded_scanlatorsQueries