From 8a243ffb578fec4b16813aa0e529a8d55c0c7e37 Mon Sep 17 00:00:00 2001 From: arkon Date: Sat, 18 Apr 2020 19:40:50 -0400 Subject: [PATCH] Include bookmark state when migrating chapters (closes #2729) --- .../tachiyomi/ui/migration/SearchPresenter.kt | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt index 354b519ff..b4b32ee53 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/migration/SearchPresenter.kt @@ -84,13 +84,22 @@ class SearchPresenter( } val prevMangaChapters = db.getChapters(prevManga).executeAsBlocking() - val maxChapterRead = prevMangaChapters.filter { it.read } - .maxBy { it.chapter_number }?.chapter_number + val maxChapterRead = prevMangaChapters + .filter { it.read } + .maxBy { it.chapter_number }?.chapter_number + val bookmarkedChapters = prevMangaChapters + .filter { it.bookmark && it.isRecognizedNumber } + .map { it.chapter_number } if (maxChapterRead != null) { val dbChapters = db.getChapters(manga).executeAsBlocking() for (chapter in dbChapters) { - if (chapter.isRecognizedNumber && chapter.chapter_number <= maxChapterRead) { - chapter.read = true + if (chapter.isRecognizedNumber) { + if (chapter.chapter_number <= maxChapterRead) { + chapter.read = true + } + if (chapter.chapter_number in bookmarkedChapters) { + chapter.bookmark = true + } } } db.insertChapters(dbChapters).executeAsBlocking()