From 521ebf0678c25c5cbb549898e83953c2a7362a53 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 8 May 2020 22:32:12 -0400 Subject: [PATCH] Remove redundant DB call in library settings (closes #3128) --- .../kanade/tachiyomi/data/backup/BackupRestoreService.kt | 8 ++++---- .../tachiyomi/ui/setting/SettingsLibraryController.kt | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt index 276f6bdf94..f28cfcfe93 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupRestoreService.kt @@ -212,6 +212,10 @@ class BackupRestoreService : Service() { // Restore individual manga mangasJson.forEach { + if (job?.isActive != true) { + throw Exception(getString(R.string.restoring_backup_canceled)) + } + restoreManga(it.asJsonObject) } @@ -252,10 +256,6 @@ class BackupRestoreService : Service() { ?: JsonArray() ) - if (job?.isActive != true) { - throw Exception(getString(R.string.restoring_backup_canceled)) - } - try { restoreMangaData(manga, chapters, categories, history, tracks) } catch (e: Exception) { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt index abfa286d8f..c5e8d4ce62 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt @@ -172,7 +172,7 @@ class SettingsLibraryController : SettingsController() { preference { titleRes = R.string.action_edit_categories - val catCount = db.getCategories().executeAsBlocking().size + val catCount = dbCategories.size summary = context.resources.getQuantityString(R.plurals.num_categories, catCount, catCount) onClick {