Another fix for mass migration

Also fixing some deprecated code

(cherry picked from commit 2535ea92ebc97bad9f30e9e48493629df6db28a3)
This commit is contained in:
jobobby04
2020-04-17 00:28:35 -04:00
committed by Jobobby04
parent 00d2d4f969
commit 01175e687c
4 changed files with 26 additions and 21 deletions
@@ -163,8 +163,10 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
val localManga = smartSearchEngine.networkToLocalManga(searchResult, source.id)
val chapters = source.fetchChapterList(localManga).toSingle().await(
Schedulers.io())
withContext(Dispatchers.IO) {
try {
syncChaptersWithSource(db, chapters, localManga, source)
} catch (e: Exception) {
return@async null
}
manga.progress.send(validSources.size to processedSources.incrementAndGet())
localManga to chapters.size
@@ -260,8 +262,10 @@ class MigrationListController(bundle: Bundle? = null) : BaseController(bundle),
}
override fun noMigration() {
activity?.toast(R.string.no_migrations)
router.popCurrentController()
launchUI {
activity?.toast(R.string.no_migrations)
router.popCurrentController()
}
}
override fun onMenuItemClick(position: Int, item: MenuItem) {
@@ -39,7 +39,7 @@ class MigrationProcessAdapter(
}
fun sourceFinished() {
if (mangasSkipped() == itemCount || itemCount == 0) menuItemListener.noMigration()
if (itemCount == 0) menuItemListener.noMigration()
if (allMangasDone()) menuItemListener.enableButtons()
}