From 22615f5981cdac5c3bb056215cf0f6361ae2824e Mon Sep 17 00:00:00 2001 From: Mohit Mandalia <36087806+MohitMandalia@users.noreply.github.com> Date: Sat, 1 Jan 2022 23:43:44 +0530 Subject: [PATCH] Fixes descriptive notification message for errors (#6413) * Fixes descriptive notification message for errors Fixes #6401 * Fixes descriptive notification message for errors Fixes #6401 --- .../eu/kanade/tachiyomi/data/download/DownloadNotifier.kt | 5 ++--- .../java/eu/kanade/tachiyomi/data/download/Downloader.kt | 4 ++-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt index e73acf1f12..e4a384c397 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadNotifier.kt +++ b/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) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt index 43d4a23e09..2954f19f7a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/Downloader.kt +++ b/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 } }