fix: wrong initial number of migrating items
This commit is contained in:
parent
2b3f082690
commit
27ca4af744
3 changed files with 8 additions and 8 deletions
|
|
@ -44,7 +44,7 @@ import tachiyomi.presentation.core.util.plus
|
||||||
fun MigrationListScreen(
|
fun MigrationListScreen(
|
||||||
items: ImmutableList<MigratingManga>,
|
items: ImmutableList<MigratingManga>,
|
||||||
migrationDone: Boolean,
|
migrationDone: Boolean,
|
||||||
unfinishedCount: Int,
|
finishedCount: Int,
|
||||||
getManga: suspend (MigratingManga.SearchResult.Result) -> Manga?,
|
getManga: suspend (MigratingManga.SearchResult.Result) -> Manga?,
|
||||||
getChapterInfo: suspend (MigratingManga.SearchResult.Result) -> MigratingManga.ChapterInfo,
|
getChapterInfo: suspend (MigratingManga.SearchResult.Result) -> MigratingManga.ChapterInfo,
|
||||||
getSourceName: (Manga) -> String,
|
getSourceName: (Manga) -> String,
|
||||||
|
|
@ -58,9 +58,9 @@ fun MigrationListScreen(
|
||||||
Scaffold(
|
Scaffold(
|
||||||
topBar = { scrollBehavior ->
|
topBar = { scrollBehavior ->
|
||||||
val titleString = stringResource(SYMR.strings.migration)
|
val titleString = stringResource(SYMR.strings.migration)
|
||||||
val title by produceState(initialValue = titleString, items, unfinishedCount, titleString) {
|
val title by produceState(initialValue = titleString, items, finishedCount, titleString) {
|
||||||
withIOContext {
|
withIOContext {
|
||||||
value = "$titleString ($unfinishedCount/${items.size})"
|
value = "$titleString ($finishedCount/${items.size})"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
AppBar(
|
AppBar(
|
||||||
|
|
|
||||||
|
|
@ -37,7 +37,7 @@ class MigrationListScreen(private val config: MigrationProcedureConfig) : Screen
|
||||||
val screenModel = rememberScreenModel { MigrationListScreenModel(config) }
|
val screenModel = rememberScreenModel { MigrationListScreenModel(config) }
|
||||||
val items by screenModel.migratingItems.collectAsState()
|
val items by screenModel.migratingItems.collectAsState()
|
||||||
val migrationDone by screenModel.migrationDone.collectAsState()
|
val migrationDone by screenModel.migrationDone.collectAsState()
|
||||||
val unfinishedCount by screenModel.unfinishedCount.collectAsState()
|
val finishedCount by screenModel.finishedCount.collectAsState()
|
||||||
val dialog by screenModel.dialog.collectAsState()
|
val dialog by screenModel.dialog.collectAsState()
|
||||||
val migrateProgress by screenModel.migratingProgress.collectAsState()
|
val migrateProgress by screenModel.migratingProgress.collectAsState()
|
||||||
val navigator = LocalNavigator.currentOrThrow
|
val navigator = LocalNavigator.currentOrThrow
|
||||||
|
|
@ -97,7 +97,7 @@ class MigrationListScreen(private val config: MigrationProcedureConfig) : Screen
|
||||||
MigrationListScreen(
|
MigrationListScreen(
|
||||||
items = items ?: persistentListOf(),
|
items = items ?: persistentListOf(),
|
||||||
migrationDone = migrationDone,
|
migrationDone = migrationDone,
|
||||||
unfinishedCount = unfinishedCount,
|
finishedCount = finishedCount,
|
||||||
getManga = screenModel::getManga,
|
getManga = screenModel::getManga,
|
||||||
getChapterInfo = screenModel::getChapterInfo,
|
getChapterInfo = screenModel::getChapterInfo,
|
||||||
getSourceName = screenModel::getSourceName,
|
getSourceName = screenModel::getSourceName,
|
||||||
|
|
|
||||||
|
|
@ -89,7 +89,7 @@ class MigrationListScreenModel(
|
||||||
|
|
||||||
val migratingItems = MutableStateFlow<ImmutableList<MigratingManga>?>(null)
|
val migratingItems = MutableStateFlow<ImmutableList<MigratingManga>?>(null)
|
||||||
val migrationDone = MutableStateFlow(false)
|
val migrationDone = MutableStateFlow(false)
|
||||||
val unfinishedCount = MutableStateFlow(0)
|
val finishedCount = MutableStateFlow(0)
|
||||||
|
|
||||||
val manualMigrations = MutableStateFlow(0)
|
val manualMigrations = MutableStateFlow(0)
|
||||||
|
|
||||||
|
|
@ -158,7 +158,7 @@ class MigrationListScreenModel(
|
||||||
|
|
||||||
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
private suspend fun runMigrations(mangas: List<MigratingManga>) {
|
||||||
throttleManager.resetThrottle()
|
throttleManager.resetThrottle()
|
||||||
unfinishedCount.value = mangas.size
|
// KMK: finishedCount.value = mangas.size
|
||||||
val useSourceWithMost = preferences.useSourceWithMost().get()
|
val useSourceWithMost = preferences.useSourceWithMost().get()
|
||||||
val useSmartSearch = preferences.smartMigration().get()
|
val useSmartSearch = preferences.smartMigration().get()
|
||||||
|
|
||||||
|
|
@ -319,7 +319,7 @@ class MigrationListScreenModel(
|
||||||
}
|
}
|
||||||
|
|
||||||
private suspend fun sourceFinished() {
|
private suspend fun sourceFinished() {
|
||||||
unfinishedCount.value = migratingItems.value.orEmpty().count {
|
finishedCount.value = migratingItems.value.orEmpty().count {
|
||||||
it.searchResult.value != SearchResult.Searching
|
it.searchResult.value != SearchResult.Searching
|
||||||
}
|
}
|
||||||
if (allMangasDone()) {
|
if (allMangasDone()) {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue