Include viewer and chapter filter preferences when migrating manga (closes #2866)

This commit is contained in:
arkon 2020-04-26 16:50:00 -04:00
parent 6ef59a5949
commit b25ab941ba

View file

@ -105,12 +105,14 @@ class SearchPresenter(
db.insertChapters(dbChapters).executeAsBlocking() db.insertChapters(dbChapters).executeAsBlocking()
} }
} }
// Update categories // Update categories
if (migrateCategories) { if (migrateCategories) {
val categories = db.getCategoriesForManga(prevManga).executeAsBlocking() val categories = db.getCategoriesForManga(prevManga).executeAsBlocking()
val mangaCategories = categories.map { MangaCategory.create(manga, it) } val mangaCategories = categories.map { MangaCategory.create(manga, it) }
db.setMangaCategories(mangaCategories, listOf(manga)) db.setMangaCategories(mangaCategories, listOf(manga))
} }
// Update track // Update track
if (migrateTracks) { if (migrateTracks) {
val tracks = db.getTracks(prevManga).executeAsBlocking() val tracks = db.getTracks(prevManga).executeAsBlocking()
@ -120,6 +122,7 @@ class SearchPresenter(
} }
db.insertTracks(tracks).executeAsBlocking() db.insertTracks(tracks).executeAsBlocking()
} }
// Update favorite status // Update favorite status
if (replace) { if (replace) {
prevManga.favorite = false prevManga.favorite = false
@ -128,6 +131,12 @@ class SearchPresenter(
manga.favorite = true manga.favorite = true
db.updateMangaFavorite(manga).executeAsBlocking() db.updateMangaFavorite(manga).executeAsBlocking()
// Update reading preferences
manga.chapter_flags = prevManga.chapter_flags
db.updateFlags(manga).executeAsBlocking()
manga.viewer = prevManga.viewer
db.updateMangaViewer(manga).executeAsBlocking()
// SearchPresenter#networkToLocalManga may have updated the manga title, so ensure db gets updated title // SearchPresenter#networkToLocalManga may have updated the manga title, so ensure db gets updated title
db.updateMangaTitle(manga).executeAsBlocking() db.updateMangaTitle(manga).executeAsBlocking()
} }