From 27ca4af74481e4f79ea39832c84cbb4cf7ca3c15 Mon Sep 17 00:00:00 2001 From: Cuong-Tran Date: Thu, 8 Aug 2024 17:58:11 +0700 Subject: [PATCH] fix: wrong initial number of migrating items --- .../eu/kanade/presentation/browse/MigrationListScreen.kt | 6 +++--- .../migration/advanced/process/MigrationListScreen.kt | 4 ++-- .../migration/advanced/process/MigrationListScreenModel.kt | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/presentation/browse/MigrationListScreen.kt b/app/src/main/java/eu/kanade/presentation/browse/MigrationListScreen.kt index 7743225cd..01b6ee9d6 100644 --- a/app/src/main/java/eu/kanade/presentation/browse/MigrationListScreen.kt +++ b/app/src/main/java/eu/kanade/presentation/browse/MigrationListScreen.kt @@ -44,7 +44,7 @@ import tachiyomi.presentation.core.util.plus fun MigrationListScreen( items: ImmutableList, migrationDone: Boolean, - unfinishedCount: Int, + finishedCount: Int, getManga: suspend (MigratingManga.SearchResult.Result) -> Manga?, getChapterInfo: suspend (MigratingManga.SearchResult.Result) -> MigratingManga.ChapterInfo, getSourceName: (Manga) -> String, @@ -58,9 +58,9 @@ fun MigrationListScreen( Scaffold( topBar = { scrollBehavior -> 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 { - value = "$titleString ($unfinishedCount/${items.size})" + value = "$titleString ($finishedCount/${items.size})" } } AppBar( diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreen.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreen.kt index 15744bb5c..806e45e38 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreen.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreen.kt @@ -37,7 +37,7 @@ class MigrationListScreen(private val config: MigrationProcedureConfig) : Screen val screenModel = rememberScreenModel { MigrationListScreenModel(config) } val items by screenModel.migratingItems.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 migrateProgress by screenModel.migratingProgress.collectAsState() val navigator = LocalNavigator.currentOrThrow @@ -97,7 +97,7 @@ class MigrationListScreen(private val config: MigrationProcedureConfig) : Screen MigrationListScreen( items = items ?: persistentListOf(), migrationDone = migrationDone, - unfinishedCount = unfinishedCount, + finishedCount = finishedCount, getManga = screenModel::getManga, getChapterInfo = screenModel::getChapterInfo, getSourceName = screenModel::getSourceName, diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreenModel.kt index a44c95fd0..d59b2ae87 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/migration/advanced/process/MigrationListScreenModel.kt @@ -89,7 +89,7 @@ class MigrationListScreenModel( val migratingItems = MutableStateFlow?>(null) val migrationDone = MutableStateFlow(false) - val unfinishedCount = MutableStateFlow(0) + val finishedCount = MutableStateFlow(0) val manualMigrations = MutableStateFlow(0) @@ -158,7 +158,7 @@ class MigrationListScreenModel( private suspend fun runMigrations(mangas: List) { throttleManager.resetThrottle() - unfinishedCount.value = mangas.size + // KMK: finishedCount.value = mangas.size val useSourceWithMost = preferences.useSourceWithMost().get() val useSmartSearch = preferences.smartMigration().get() @@ -319,7 +319,7 @@ class MigrationListScreenModel( } private suspend fun sourceFinished() { - unfinishedCount.value = migratingItems.value.orEmpty().count { + finishedCount.value = migratingItems.value.orEmpty().count { it.searchResult.value != SearchResult.Searching } if (allMangasDone()) {