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 {
|
unfinishedCount.value = migratingItems.value.count {
|
||||||
it.searchResult.value != SearchResult.Searching
|
it.searchResult.value != SearchResult.Searching
|
||||||
}
|
}
|
||||||
if (allMangasDone()) {
|
if (allMangasDone()) {
|
||||||
migrationDone.value = true
|
migrationDone.value = true
|
||||||
}
|
}
|
||||||
|
if (migratingItems.value.isEmpty()) {
|
||||||
|
navigateOut()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun allMangasDone() = migratingItems.value.all { it.searchResult.value != SearchResult.Searching } &&
|
fun allMangasDone() = migratingItems.value.all { it.searchResult.value != SearchResult.Searching } &&
|
||||||
@ -481,12 +484,6 @@ class MigrationListScreenModel(
|
|||||||
coroutineScope.launchIO {
|
coroutineScope.launchIO {
|
||||||
val item = migratingItems.value.find { it.manga.id == mangaId }
|
val item = migratingItems.value.find { it.manga.id == mangaId }
|
||||||
?: return@launchIO
|
?: return@launchIO
|
||||||
if (migratingItems.value.size == 1) {
|
|
||||||
item.searchResult.value = SearchResult.NotFound
|
|
||||||
item.migrationScope.cancel()
|
|
||||||
sourceFinished()
|
|
||||||
return@launchIO
|
|
||||||
}
|
|
||||||
removeManga(item)
|
removeManga(item)
|
||||||
item.migrationScope.cancel()
|
item.migrationScope.cancel()
|
||||||
sourceFinished()
|
sourceFinished()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user