mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-21 20:47:03 -05:00
Make metadata updating optional
This commit is contained in:
parent
4fdb4f14a8
commit
259946cf0a
5 changed files with 24 additions and 10 deletions
|
@ -334,6 +334,7 @@ class LibraryUpdateService(
|
||||||
val source = sourceManager.get(manga.source) ?: return Observable.empty()
|
val source = sourceManager.get(manga.source) ?: return Observable.empty()
|
||||||
|
|
||||||
// Update manga details metadata in the background
|
// Update manga details metadata in the background
|
||||||
|
if (preferences.autoUpdateMetadata()) {
|
||||||
source.fetchMangaDetails(manga)
|
source.fetchMangaDetails(manga)
|
||||||
.map { networkManga ->
|
.map { networkManga ->
|
||||||
manga.prepUpdateCover(coverCache, networkManga, false)
|
manga.prepUpdateCover(coverCache, networkManga, false)
|
||||||
|
@ -344,6 +345,7 @@ class LibraryUpdateService(
|
||||||
.onErrorResumeNext { Observable.just(manga) }
|
.onErrorResumeNext { Observable.just(manga) }
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.subscribe()
|
.subscribe()
|
||||||
|
}
|
||||||
|
|
||||||
return source.fetchChapterList(manga)
|
return source.fetchChapterList(manga)
|
||||||
.map { syncChaptersWithSource(db, it, manga, source) }
|
.map { syncChaptersWithSource(db, it, manga, source) }
|
||||||
|
|
|
@ -123,6 +123,8 @@ object PreferenceKeys {
|
||||||
|
|
||||||
const val hideNotificationContent = "hide_notification_content"
|
const val hideNotificationContent = "hide_notification_content"
|
||||||
|
|
||||||
|
const val autoUpdateMetadata = "auto_update_metadata"
|
||||||
|
|
||||||
const val showLibraryUpdateErrors = "show_library_update_errors"
|
const val showLibraryUpdateErrors = "show_library_update_errors"
|
||||||
|
|
||||||
const val downloadNew = "download_new"
|
const val downloadNew = "download_new"
|
||||||
|
|
|
@ -67,6 +67,8 @@ class PreferencesHelper(val context: Context) {
|
||||||
|
|
||||||
fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
|
fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
|
||||||
|
|
||||||
|
fun autoUpdateMetadata() = prefs.getBoolean(Keys.autoUpdateMetadata, false)
|
||||||
|
|
||||||
fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, false)
|
fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, false)
|
||||||
|
|
||||||
fun clear() = prefs.edit().clear().apply()
|
fun clear() = prefs.edit().clear().apply()
|
||||||
|
|
|
@ -199,6 +199,12 @@ class SettingsLibraryController : SettingsController() {
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
switchPreference {
|
||||||
|
key = Keys.autoUpdateMetadata
|
||||||
|
titleRes = R.string.pref_library_update_refresh_metadata
|
||||||
|
summaryRes = R.string.pref_library_update_refresh_metadata_summary
|
||||||
|
defaultValue = false
|
||||||
|
}
|
||||||
switchPreference {
|
switchPreference {
|
||||||
key = Keys.showLibraryUpdateErrors
|
key = Keys.showLibraryUpdateErrors
|
||||||
titleRes = R.string.pref_library_update_error_notification
|
titleRes = R.string.pref_library_update_error_notification
|
||||||
|
|
|
@ -184,6 +184,8 @@
|
||||||
<string name="wifi">Wi-Fi</string>
|
<string name="wifi">Wi-Fi</string>
|
||||||
<string name="charging">Charging</string>
|
<string name="charging">Charging</string>
|
||||||
<string name="pref_update_only_non_completed">Only update ongoing manga</string>
|
<string name="pref_update_only_non_completed">Only update ongoing manga</string>
|
||||||
|
<string name="pref_library_update_refresh_metadata">Automatically refresh metadata</string>
|
||||||
|
<string name="pref_library_update_refresh_metadata_summary">Check for new cover and details when updating library</string>
|
||||||
<string name="pref_library_update_error_notification">Show update errors notifications</string>
|
<string name="pref_library_update_error_notification">Show update errors notifications</string>
|
||||||
|
|
||||||
<string name="pref_category_library_categories">Categories</string>
|
<string name="pref_category_library_categories">Categories</string>
|
||||||
|
|
Loading…
Reference in a new issue