浏览代码

Make library update error notification optional (closes #3200)

arkon 4 年之前
父节点
当前提交
647391ef73

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt

@@ -307,7 +307,7 @@ class LibraryUpdateService(
                     }
                 }
 
-                if (failedUpdates.isNotEmpty()) {
+                if (preferences.showLibraryUpdateErrors() && failedUpdates.isNotEmpty()) {
                     val errorFile = writeErrorFile(failedUpdates)
                     notifier.showUpdateErrorNotification(
                         failedUpdates.map { it.first.title },

+ 2 - 0
app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferenceKeys.kt

@@ -123,6 +123,8 @@ object PreferenceKeys {
 
     const val hideNotificationContent = "hide_notification_content"
 
+    const val showLibraryUpdateErrors = "show_library_update_errors"
+
     const val downloadNew = "download_new"
 
     const val downloadNewCategories = "download_new_categories"

+ 2 - 0
app/src/main/java/eu/kanade/tachiyomi/data/preference/PreferencesHelper.kt

@@ -67,6 +67,8 @@ class PreferencesHelper(val context: Context) {
 
     fun hideNotificationContent() = prefs.getBoolean(Keys.hideNotificationContent, false)
 
+    fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, false)
+
     fun clear() = prefs.edit().clear().apply()
 
     fun themeMode() = flowPrefs.getString(Keys.themeMode, Values.THEME_MODE_SYSTEM)

+ 1 - 1
app/src/main/java/eu/kanade/tachiyomi/ui/recent/history/HistoryPresenter.kt

@@ -120,7 +120,7 @@ class HistoryPresenter : BasePresenter<HistoryController>() {
             }
             Manga.SORTING_UPLOAD_DATE -> {
                 chapters.drop(currChapterIndex + 1)
-                        .firstOrNull { it.date_upload >= chapter.date_upload}
+                    .firstOrNull { it.date_upload >= chapter.date_upload }
             }
             else -> throw NotImplementedError("Unknown sorting method")
         }

+ 5 - 0
app/src/main/java/eu/kanade/tachiyomi/ui/setting/SettingsLibraryController.kt

@@ -164,6 +164,11 @@ class SettingsLibraryController : SettingsController() {
                     true
                 }
             }
+            switchPreference {
+                key = Keys.showLibraryUpdateErrors
+                titleRes = R.string.pref_library_update_error_notification
+                defaultValue = false
+            }
         }
 
         preferenceCategory {

+ 1 - 0
app/src/main/res/values/strings.xml

@@ -184,6 +184,7 @@
     <string name="wifi">Wi-Fi</string>
     <string name="charging">Charging</string>
     <string name="pref_update_only_non_completed">Only update ongoing manga</string>
+    <string name="pref_library_update_error_notification">Show update errors notifications</string>
 
     <string name="pref_category_library_categories">Categories</string>
     <string name="default_category">Default category</string>