Move chapter preferences from PreferencesHelper to LibraryPrefrences (#8061)

This commit is contained in:
Andreas
2022-09-24 16:14:16 +02:00
committed by GitHub
parent 747cbd24cb
commit b5dca2eb09
15 changed files with 154 additions and 128 deletions

View File

@@ -306,6 +306,26 @@ object Migrations {
BackupCreatorJob.setupTask(context)
}
}
if (oldVersion < 85) {
val preferences = listOf(
libraryPreferences.filterChapterByRead(),
libraryPreferences.filterChapterByDownloaded(),
libraryPreferences.filterChapterByBookmarked(),
libraryPreferences.sortChapterBySourceOrNumber(),
libraryPreferences.displayChapterByNameOrNumber(),
libraryPreferences.sortChapterByAscendingOrDescending(),
)
prefs.edit {
preferences.forEach { preference ->
val key = preference.key()
val value = prefs.getInt(key, Int.MIN_VALUE)
if (value == Int.MIN_VALUE) return@forEach
remove(key)
putLong(key, value.toLong())
}
}
}
return true
}