Fix default category and manga sometimes not having their category restored (#3891)
This commit is contained in:
@@ -26,6 +26,7 @@ The format is a modified version of [Keep a Changelog](https://keepachangelog.co
|
||||
- Fixed app and extension update check running again on configuration change ([@AntsyLich](https://github.com/AntsyLich)) ([#3708](https://github.com/mihonapp/mihon/pull/3708))
|
||||
- Fixed MangaBaka user start/finish dates drifting in negative offset timezones ([@MajorTanya](https://github.com/MajorTanya)) ([#3711](https://github.com/mihonapp/mihon/pull/3711))
|
||||
- Fixed MangaBaka scores being wrong when score step size was set to > 1 ([@MajorTanya](https://github.com/MajorTanya)) ([#3740](https://github.com/mihonapp/mihon/pull/3740))
|
||||
- Fixed default category and manga sometimes not getting their category set when restoring a backup ([@Secozzi](https://github.com/Secozzi)) ([#3891](https://github.com/mihonapp/mihon/pull/3891))
|
||||
|
||||
## [v0.20.4] - 2026-08-05
|
||||
### Fixed
|
||||
|
||||
@@ -19,6 +19,7 @@ import eu.kanade.tachiyomi.data.backup.restore.restorers.PreferenceRestorer
|
||||
import eu.kanade.tachiyomi.data.download.DownloadCache
|
||||
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
|
||||
import kotlinx.coroutines.CoroutineScope
|
||||
import kotlinx.coroutines.Job
|
||||
import kotlinx.coroutines.coroutineScope
|
||||
import kotlinx.coroutines.ensureActive
|
||||
import kotlinx.coroutines.launch
|
||||
@@ -116,17 +117,27 @@ class BackupRestorer(
|
||||
}
|
||||
|
||||
coroutineScope {
|
||||
if (options.categories) {
|
||||
val restoreCategoriesJob = if (options.categories) {
|
||||
restoreCategories(backup.backupCategories)
|
||||
} else {
|
||||
null
|
||||
}
|
||||
if (options.appSettings) {
|
||||
restoreAppPreferences(backup.backupPreferences, backup.backupCategories.takeIf { options.categories })
|
||||
restoreAppPreferences(
|
||||
backup.backupPreferences,
|
||||
backup.backupCategories.takeIf { options.categories },
|
||||
restoreCategoriesJob,
|
||||
)
|
||||
}
|
||||
if (options.sourceSettings) {
|
||||
restoreSourcePreferences(backup.backupSourcePreferences)
|
||||
}
|
||||
if (options.libraryEntries) {
|
||||
restoreManga(backup.backupManga, if (options.categories) backup.backupCategories else emptyList())
|
||||
restoreManga(
|
||||
backup.backupManga,
|
||||
if (options.categories) backup.backupCategories else emptyList(),
|
||||
restoreCategoriesJob,
|
||||
)
|
||||
}
|
||||
if (options.extensionStores) {
|
||||
restoreExtensionStores(backup.backupExtensionStores)
|
||||
@@ -152,7 +163,9 @@ class BackupRestorer(
|
||||
private fun CoroutineScope.restoreManga(
|
||||
backupMangas: List<BackupManga>,
|
||||
backupCategories: List<BackupCategory>,
|
||||
categoriesRestoreJob: Job?,
|
||||
) = launch {
|
||||
categoriesRestoreJob?.join()
|
||||
mangaRestorer.sortByNew(backupMangas)
|
||||
.chunked(100)
|
||||
.forEach { chunk ->
|
||||
@@ -195,8 +208,10 @@ class BackupRestorer(
|
||||
private fun CoroutineScope.restoreAppPreferences(
|
||||
preferences: List<BackupPreference>,
|
||||
categories: List<BackupCategory>?,
|
||||
categoriesRestoreJob: Job?,
|
||||
) = launch {
|
||||
ensureActive()
|
||||
categoriesRestoreJob?.join()
|
||||
preferenceRestorer.restoreApp(
|
||||
preferences,
|
||||
categories,
|
||||
|
||||
Reference in New Issue
Block a user