mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-31 14:27:57 +01:00 
			
		
		
		
	Add option for library update only update completely read manga (#6323)
* Add option for library update only update completely read manga only check manga for updates if there is no unread chapter * sum
This commit is contained in:
		| @@ -262,6 +262,10 @@ class LibraryUpdateService( | ||||
|             listToUpdate = listToUpdate.filterNot { it.status == SManga.COMPLETED } | ||||
|         } | ||||
|  | ||||
|         if (target == Target.CHAPTERS && preferences.updateOnlyCompletelyRead()) { | ||||
|             listToUpdate = listToUpdate.filter { it.unread == 0 } | ||||
|         } | ||||
|  | ||||
|         val selectedScheme = preferences.libraryUpdatePrioritization().get() | ||||
|         mangaToUpdate = listToUpdate | ||||
|             .distinctBy { it.id } | ||||
|   | ||||
| @@ -101,6 +101,8 @@ object PreferenceKeys { | ||||
|  | ||||
|     const val updateOnlyNonCompleted = "pref_update_only_non_completed_key" | ||||
|  | ||||
|     const val updateOnlyCompletelyRead = "pref_update_only_completely_read" | ||||
|  | ||||
|     const val autoUpdateTrack = "pref_auto_update_manga_sync_key" | ||||
|  | ||||
|     const val lastUsedSource = "last_catalogue_source" | ||||
|   | ||||
| @@ -179,6 +179,8 @@ class PreferencesHelper(val context: Context) { | ||||
|  | ||||
|     fun updateOnlyNonCompleted() = prefs.getBoolean(Keys.updateOnlyNonCompleted, true) | ||||
|  | ||||
|     fun updateOnlyCompletelyRead() = prefs.getBoolean(Keys.updateOnlyCompletelyRead, true) | ||||
|  | ||||
|     fun autoUpdateTrack() = prefs.getBoolean(Keys.autoUpdateTrack, true) | ||||
|  | ||||
|     fun lastUsedSource() = flowPrefs.getLong(Keys.lastUsedSource, -1) | ||||
|   | ||||
| @@ -199,6 +199,12 @@ class SettingsLibraryController : SettingsController() { | ||||
|                 titleRes = R.string.pref_update_only_non_completed | ||||
|                 defaultValue = true | ||||
|             } | ||||
|             switchPreference { | ||||
|                 key = Keys.updateOnlyCompletelyRead | ||||
|                 titleRes = R.string.pref_update_only_completely_read | ||||
|                 summaryRes = R.string.pref_update_only_completely_read_summary | ||||
|                 defaultValue = false | ||||
|             } | ||||
|             preference { | ||||
|                 key = Keys.libraryUpdateCategories | ||||
|                 titleRes = R.string.categories | ||||
|   | ||||
| @@ -222,6 +222,8 @@ | ||||
|     <string name="charging">Charging</string> | ||||
|     <string name="restrictions">Restrictions: %s</string> | ||||
|     <string name="pref_update_only_non_completed">Only update ongoing manga</string> | ||||
|     <string name="pref_update_only_completely_read">Only update completely read manga</string> | ||||
|     <string name="pref_update_only_completely_read_summary">Only update manga if there is no unread chapter(completely read)</string> | ||||
|     <string name="pref_library_update_show_tab_badge">Show unread count on Updates icon</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> | ||||
|   | ||||
		Reference in New Issue
	
	Block a user