diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt index 7cf65cbc8a..4d3286cce0 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/restore/restorers/MangaRestorer.kt @@ -205,6 +205,7 @@ class MangaRestorer( bookmark = chapter.bookmark || dbChapter.bookmark, read = chapter.read, lastPageRead = chapter.lastPageRead, + sourceOrder = chapter.sourceOrder, ) } else { chapter.copyFrom(dbChapter).let { @@ -255,7 +256,7 @@ class MangaRestorer( bookmark = chapter.bookmark, lastPageRead = chapter.lastPageRead, chapterNumber = null, - sourceOrder = null, + sourceOrder = if (isSync) chapter.sourceOrder else null, dateFetch = null, dateUpload = null, chapterId = chapter.id, diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/sync/service/SyncService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/sync/service/SyncService.kt index 2524fbab1f..c16083bfaf 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/sync/service/SyncService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/sync/service/SyncService.kt @@ -233,7 +233,12 @@ abstract class SyncService( localChapter != null && remoteChapter != null -> { // Use version number to decide which chapter to keep val chosenChapter = if (localChapter.version >= remoteChapter.version) { - localChapter + // If there mare more chapter on remote, local sourceOrder will need to be updated to maintain correct source order. + if (localChapters.size < remoteChapters.size) { + localChapter.copy(sourceOrder = remoteChapter.sourceOrder) + } else { + localChapter + } } else { remoteChapter } @@ -500,6 +505,7 @@ abstract class SyncService( logcat(LogPriority.DEBUG, logTag) { "Using remote saved search: ${remoteSearch.name}." } remoteSearch } + else -> { logcat(LogPriority.DEBUG, logTag) { "No saved search found for composite key: $compositeKey. Skipping."