From 4bc228880654320fdeec3d337d4dd948c5ab1269 Mon Sep 17 00:00:00 2001 From: arkon Date: Tue, 14 Jul 2020 09:04:15 -0400 Subject: [PATCH] Allow category names with different casing (fixes #3465) --- .../java/eu/kanade/tachiyomi/data/backup/BackupManager.kt | 4 ++-- .../java/eu/kanade/tachiyomi/data/database/models/Category.kt | 3 --- .../java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt index 95353f42a6..8761f0a7f9 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/backup/BackupManager.kt @@ -325,7 +325,7 @@ class BackupManager(val context: Context, version: Int = CURRENT_VERSION) { for (dbCategory in dbCategories) { // If the category is already in the db, assign the id to the file's category // and do nothing - if (category.nameLower == dbCategory.nameLower) { + if (category.name == dbCategory.name) { category.id = dbCategory.id found = true break @@ -353,7 +353,7 @@ class BackupManager(val context: Context, version: Int = CURRENT_VERSION) { val mangaCategoriesToUpdate = mutableListOf() for (backupCategoryStr in categories) { for (dbCategory in dbCategories) { - if (backupCategoryStr.toLowerCase() == dbCategory.nameLower) { + if (backupCategoryStr == dbCategory.name) { mangaCategoriesToUpdate.add(MangaCategory.create(manga, dbCategory)) break } diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt index 3657caa729..43ef84c4ed 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/database/models/Category.kt @@ -12,9 +12,6 @@ interface Category : Serializable { var flags: Int - val nameLower: String - get() = name.toLowerCase() - companion object { fun create(name: String): Category = CategoryImpl().apply { diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt index 7af2d2368f..273d62e3ea 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/category/CategoryPresenter.kt @@ -101,6 +101,6 @@ class CategoryPresenter( * Returns true if a category with the given name already exists. */ private fun categoryExists(name: String): Boolean { - return categories.any { it.name.equals(name, true) } + return categories.any { it.name == name } } }