From 58acf0a8aa3aa37b5d9c63d99987a05ee2f8790f Mon Sep 17 00:00:00 2001 From: Andreas Date: Sun, 31 Jul 2022 17:17:43 +0200 Subject: [PATCH] Remove deprecated LibrarySort (#7659) * Remove deprecated LibrarySort * Apply suggestions from code review --- .../java/eu/kanade/tachiyomi/Migrations.kt | 23 ++++++++----------- .../tachiyomi/ui/library/LibrarySort.kt | 17 -------------- 2 files changed, 10 insertions(+), 30 deletions(-) delete mode 100644 app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index c17493a637..10bdd4ce42 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -13,7 +13,6 @@ import eu.kanade.tachiyomi.data.track.TrackManager import eu.kanade.tachiyomi.data.updater.AppUpdateJob import eu.kanade.tachiyomi.extension.ExtensionUpdateJob import eu.kanade.tachiyomi.network.PREF_DOH_CLOUDFLARE -import eu.kanade.tachiyomi.ui.library.LibrarySort import eu.kanade.tachiyomi.ui.library.setting.SortDirectionSetting import eu.kanade.tachiyomi.ui.library.setting.SortModeSetting import eu.kanade.tachiyomi.ui.reader.setting.OrientationType @@ -104,10 +103,9 @@ object Migrations { // Reset sorting preference if using removed sort by source val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0) - @Suppress("DEPRECATION") - if (oldSortingMode == LibrarySort.SOURCE) { + if (oldSortingMode == 5 /* SOURCE */) { prefs.edit { - putInt(PreferenceKeys.librarySortingMode, LibrarySort.ALPHA) + putInt(PreferenceKeys.librarySortingMode, 0 /* ALPHABETICAL */) } } } @@ -200,16 +198,15 @@ object Migrations { val oldSortingMode = prefs.getInt(PreferenceKeys.librarySortingMode, 0) val oldSortingDirection = prefs.getBoolean(PreferenceKeys.librarySortingDirection, true) - @Suppress("DEPRECATION") val newSortingMode = when (oldSortingMode) { - LibrarySort.ALPHA -> SortModeSetting.ALPHABETICAL - LibrarySort.LAST_READ -> SortModeSetting.LAST_READ - LibrarySort.LAST_CHECKED -> SortModeSetting.LAST_CHECKED - LibrarySort.UNREAD -> SortModeSetting.UNREAD - LibrarySort.TOTAL -> SortModeSetting.TOTAL_CHAPTERS - LibrarySort.LATEST_CHAPTER -> SortModeSetting.LATEST_CHAPTER - LibrarySort.CHAPTER_FETCH_DATE -> SortModeSetting.DATE_FETCHED - LibrarySort.DATE_ADDED -> SortModeSetting.DATE_ADDED + 0 -> SortModeSetting.ALPHABETICAL + 1 -> SortModeSetting.LAST_READ + 2 -> SortModeSetting.LAST_CHECKED + 3 -> SortModeSetting.UNREAD + 4 -> SortModeSetting.TOTAL_CHAPTERS + 6 -> SortModeSetting.LATEST_CHAPTER + 8 -> SortModeSetting.DATE_FETCHED + 7 -> SortModeSetting.DATE_ADDED else -> SortModeSetting.ALPHABETICAL } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt deleted file mode 100644 index 1190d61c1d..0000000000 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibrarySort.kt +++ /dev/null @@ -1,17 +0,0 @@ -package eu.kanade.tachiyomi.ui.library - -@Deprecated("Deprecated in favor for SortModeSetting") -object LibrarySort { - - const val ALPHA = 0 - const val LAST_READ = 1 - const val LAST_CHECKED = 2 - const val UNREAD = 3 - const val TOTAL = 4 - const val LATEST_CHAPTER = 6 - const val CHAPTER_FETCH_DATE = 8 - const val DATE_ADDED = 7 - - @Deprecated("Removed in favor of searching by source") - const val SOURCE = 5 -}