Rewrite backup categories
This commit is contained in:
parent
e32f4eb317
commit
f4200e2146
@ -343,13 +343,14 @@ class FullBackupManager(val context: Context) : AbstractBackupManager() {
|
||||
internal fun restoreCategoriesForManga(manga: Manga, categories: List<Int>, backupCategories: List<BackupCategory>) {
|
||||
val dbCategories = databaseHelper.getCategories().executeAsBlocking()
|
||||
val mangaCategoriesToUpdate = mutableListOf<MangaCategory>()
|
||||
for (backupCategoryStr in categories) {
|
||||
for (backupCategory in backupCategories) {
|
||||
if (backupCategoryStr == backupCategory.order) {
|
||||
dbCategories.firstOrNull { it.name == backupCategory.name }?.let { dbCategory ->
|
||||
mangaCategoriesToUpdate.add(MangaCategory.create(manga, dbCategory))
|
||||
}
|
||||
break
|
||||
categories.forEach { backupCategoryOrder ->
|
||||
backupCategories.firstOrNull {
|
||||
it.order == backupCategoryOrder
|
||||
}?.let { backupCategory ->
|
||||
dbCategories.firstOrNull { dbCategory ->
|
||||
dbCategory.name == backupCategory.name
|
||||
}?.let { dbCategory ->
|
||||
mangaCategoriesToUpdate.add(MangaCategory.create(manga, dbCategory))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user