mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-28 03:57:50 +02:00
Fix backup/restore of category related preferences (#1726)
Co-authored-by: AntsyLich <59261191+AntsyLich@users.noreply.github.com>
This commit is contained in:
@ -26,22 +26,25 @@ class DownloadPreferences(
|
||||
|
||||
fun removeBookmarkedChapters() = preferenceStore.getBoolean("pref_remove_bookmarked", false)
|
||||
|
||||
fun removeExcludeCategories() = preferenceStore.getStringSet(
|
||||
"remove_exclude_categories",
|
||||
emptySet(),
|
||||
)
|
||||
fun removeExcludeCategories() = preferenceStore.getStringSet(REMOVE_EXCLUDE_CATEGORIES_PREF_KEY, emptySet())
|
||||
|
||||
fun downloadNewChapters() = preferenceStore.getBoolean("download_new", false)
|
||||
|
||||
fun downloadNewChapterCategories() = preferenceStore.getStringSet(
|
||||
"download_new_categories",
|
||||
emptySet(),
|
||||
)
|
||||
fun downloadNewChapterCategories() = preferenceStore.getStringSet(DOWNLOAD_NEW_CATEGORIES_PREF_KEY, emptySet())
|
||||
|
||||
fun downloadNewChapterCategoriesExclude() = preferenceStore.getStringSet(
|
||||
"download_new_categories_exclude",
|
||||
emptySet(),
|
||||
)
|
||||
fun downloadNewChapterCategoriesExclude() =
|
||||
preferenceStore.getStringSet(DOWNLOAD_NEW_CATEGORIES_EXCLUDE_PREF_KEY, emptySet())
|
||||
|
||||
fun downloadNewUnreadChaptersOnly() = preferenceStore.getBoolean("download_new_unread_chapters_only", false)
|
||||
|
||||
companion object {
|
||||
private const val REMOVE_EXCLUDE_CATEGORIES_PREF_KEY = "remove_exclude_categories"
|
||||
private const val DOWNLOAD_NEW_CATEGORIES_PREF_KEY = "download_new_categories"
|
||||
private const val DOWNLOAD_NEW_CATEGORIES_EXCLUDE_PREF_KEY = "download_new_categories_exclude"
|
||||
val categoryPreferenceKeys = setOf(
|
||||
REMOVE_EXCLUDE_CATEGORIES_PREF_KEY,
|
||||
DOWNLOAD_NEW_CATEGORIES_PREF_KEY,
|
||||
DOWNLOAD_NEW_CATEGORIES_EXCLUDE_PREF_KEY,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ class LibraryPreferences(
|
||||
|
||||
// region Category
|
||||
|
||||
fun defaultCategory() = preferenceStore.getInt("default_category", -1)
|
||||
fun defaultCategory() = preferenceStore.getInt(DEFAULT_CATEGORY_PREF_KEY, -1)
|
||||
|
||||
fun lastUsedCategory() = preferenceStore.getInt(Preference.appStateKey("last_used_category"), 0)
|
||||
|
||||
@ -119,12 +119,9 @@ class LibraryPreferences(
|
||||
|
||||
fun categorizedDisplaySettings() = preferenceStore.getBoolean("categorized_display", false)
|
||||
|
||||
fun updateCategories() = preferenceStore.getStringSet("library_update_categories", emptySet())
|
||||
fun updateCategories() = preferenceStore.getStringSet(LIBRARY_UPDATE_CATEGORIES_PREF_KEY, emptySet())
|
||||
|
||||
fun updateCategoriesExclude() = preferenceStore.getStringSet(
|
||||
"library_update_categories_exclude",
|
||||
emptySet(),
|
||||
)
|
||||
fun updateCategoriesExclude() = preferenceStore.getStringSet(LIBRARY_UPDATE_CATEGORIES_EXCLUDE_PREF_KEY, emptySet())
|
||||
|
||||
// endregion
|
||||
|
||||
@ -206,5 +203,14 @@ class LibraryPreferences(
|
||||
const val MANGA_HAS_UNREAD = "manga_fully_read"
|
||||
const val MANGA_NON_READ = "manga_started"
|
||||
const val MANGA_OUTSIDE_RELEASE_PERIOD = "manga_outside_release_period"
|
||||
|
||||
const val DEFAULT_CATEGORY_PREF_KEY = "default_category"
|
||||
private const val LIBRARY_UPDATE_CATEGORIES_PREF_KEY = "library_update_categories"
|
||||
private const val LIBRARY_UPDATE_CATEGORIES_EXCLUDE_PREF_KEY = "library_update_categories_exclude"
|
||||
val categoryPreferenceKeys = setOf(
|
||||
DEFAULT_CATEGORY_PREF_KEY,
|
||||
LIBRARY_UPDATE_CATEGORIES_PREF_KEY,
|
||||
LIBRARY_UPDATE_CATEGORIES_EXCLUDE_PREF_KEY,
|
||||
)
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user