Преглед изворни кода

Fixes descriptive notification message for errors (#6413)

* Fixes descriptive notification message for errors
Fixes #6401

* Fixes descriptive notification message for errors
Fixes #6401
Mohit Mandalia пре 3 година
родитељ
комит
22615f5981

+ 2 - 3
app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt

@@ -209,12 +209,11 @@ internal class DownloadNotifier(private val context: Context) {
      * @param error string containing error information.
      * @param chapter string containing chapter title.
      */
-    fun onError(error: String? = null, chapter: String? = null) {
+    fun onError(error: String? = null, chapter: String? = null, mangaTitle: String? = null) {
         // Create notification
         with(errorNotificationBuilder) {
             setContentTitle(
-                chapter
-                    ?: context.getString(R.string.download_notifier_downloader_title)
+                mangaTitle?.plus(": $chapter") ?: context.getString(R.string.download_notifier_downloader_title)
             )
             setContentText(error ?: context.getString(R.string.download_notifier_unknown_error))
             setSmallIcon(R.drawable.ic_warning_white_24dp)

+ 2 - 2
app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt

@@ -292,7 +292,7 @@ class Downloader(
         val availSpace = DiskUtil.getAvailableStorageSpace(mangaDir)
         if (availSpace != -1L && availSpace < MIN_DISK_SPACE) {
             download.status = Download.State.ERROR
-            notifier.onError(context.getString(R.string.download_insufficient_space), download.chapter.name)
+            notifier.onError(context.getString(R.string.download_insufficient_space), download.chapter.name, download.manga.title)
             return@defer Observable.just(download)
         }
 
@@ -338,7 +338,7 @@ class Downloader(
             // If the page list threw, it will resume here
             .onErrorReturn { error ->
                 download.status = Download.State.ERROR
-                notifier.onError(error.message, download.chapter.name)
+                notifier.onError(error.message, download.chapter.name, download.manga.title)
                 download
             }
     }