diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 24ea960b0d..f5809ba5f9 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -25,7 +25,7 @@ android { applicationId = "eu.kanade.tachiyomi" minSdk = AndroidConfig.minSdk targetSdk = AndroidConfig.targetSdk - versionCode = 80 + versionCode = 81 versionName = "0.13.4" buildConfigField("String", "COMMIT_COUNT", "\"${getCommitCount()}\"") diff --git a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt index 0674fc2433..c17493a637 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/Migrations.kt @@ -204,11 +204,11 @@ object Migrations { val newSortingMode = when (oldSortingMode) { LibrarySort.ALPHA -> SortModeSetting.ALPHABETICAL LibrarySort.LAST_READ -> SortModeSetting.LAST_READ - LibrarySort.LAST_CHECKED -> SortModeSetting.LAST_MANGA_UPDATE - LibrarySort.UNREAD -> SortModeSetting.UNREAD_COUNT + 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.CHAPTER_FETCH_DATE + LibrarySort.CHAPTER_FETCH_DATE -> SortModeSetting.DATE_FETCHED LibrarySort.DATE_ADDED -> SortModeSetting.DATE_ADDED else -> SortModeSetting.ALPHABETICAL } @@ -266,6 +266,17 @@ object Migrations { preferences.navigationModeWebtoon().set(5) } } + if (oldVersion < 81) { + // Handle renamed enum values + @Suppress("DEPRECATION") + val newSortingMode = when (val oldSortingMode = preferences.librarySortingMode().get()) { + SortModeSetting.LAST_CHECKED -> SortModeSetting.LAST_MANGA_UPDATE + SortModeSetting.UNREAD -> SortModeSetting.UNREAD_COUNT + SortModeSetting.DATE_FETCHED -> SortModeSetting.CHAPTER_FETCH_DATE + else -> oldSortingMode + } + preferences.librarySortingMode().set(newSortingMode) + } return true } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt index 41acf21751..7e3fa73c4f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/LibraryPresenter.kt @@ -318,6 +318,7 @@ class LibraryPresenter( SortModeSetting.DATE_ADDED -> { i1.manga.date_added.compareTo(i2.manga.date_added) } + else -> throw IllegalStateException("Invalid SortModeSetting: $sortingMode") } } diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/setting/SortModeSetting.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/setting/SortModeSetting.kt index 8a0a758606..d7fe8a16f1 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/setting/SortModeSetting.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/setting/SortModeSetting.kt @@ -11,7 +11,17 @@ enum class SortModeSetting(val flag: Int) { TOTAL_CHAPTERS(0b00010000), LATEST_CHAPTER(0b00010100), CHAPTER_FETCH_DATE(0b00011000), - DATE_ADDED(0b00011100); + DATE_ADDED(0b00011100), + + @Deprecated("Use LAST_MANGA_UPDATE") + LAST_CHECKED(0b00001000), + + @Deprecated("Use UNREAD_COUNT") + UNREAD(0b00001100), + + @Deprecated("Use CHAPTER_FETCH_DATE") + DATE_FETCHED(0b00011000), + ; companion object { // Mask supports for more sorting flags if necessary