Fix navigating out when all migrations are done or skipped
This commit is contained in:
parent
afbe097f76
commit
b7561184ea
@ -274,13 +274,16 @@ class MigrationListScreenModel(
|
||||
}
|
||||
}
|
||||
|
||||
private fun sourceFinished() {
|
||||
private suspend fun sourceFinished() {
|
||||
unfinishedCount.value = migratingItems.value.count {
|
||||
it.searchResult.value != SearchResult.Searching
|
||||
}
|
||||
if (allMangasDone()) {
|
||||
migrationDone.value = true
|
||||
}
|
||||
if (migratingItems.value.isEmpty()) {
|
||||
navigateOut()
|
||||
}
|
||||
}
|
||||
|
||||
fun allMangasDone() = migratingItems.value.all { it.searchResult.value != SearchResult.Searching } &&
|
||||
@ -481,12 +484,6 @@ class MigrationListScreenModel(
|
||||
coroutineScope.launchIO {
|
||||
val item = migratingItems.value.find { it.manga.id == mangaId }
|
||||
?: return@launchIO
|
||||
if (migratingItems.value.size == 1) {
|
||||
item.searchResult.value = SearchResult.NotFound
|
||||
item.migrationScope.cancel()
|
||||
sourceFinished()
|
||||
return@launchIO
|
||||
}
|
||||
removeManga(item)
|
||||
item.migrationScope.cancel()
|
||||
sourceFinished()
|
||||
|
Loading…
x
Reference in New Issue
Block a user