Fix crash when using renamed library sort methods (fixes #7092)
This commit is contained in:
parent
85ef40d0ff
commit
681e9396b3
4 changed files with 27 additions and 5 deletions
|
@ -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()}\"")
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
|
@ -318,6 +318,7 @@ class LibraryPresenter(
|
|||
SortModeSetting.DATE_ADDED -> {
|
||||
i1.manga.date_added.compareTo(i2.manga.date_added)
|
||||
}
|
||||
else -> throw IllegalStateException("Invalid SortModeSetting: $sortingMode")
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Reference in a new issue