From 8ef3ab0d49db7f4f8acbd060f3a971cbeadafdcf Mon Sep 17 00:00:00 2001 From: inorichi Date: Wed, 29 Mar 2017 09:17:53 +0200 Subject: [PATCH] Cancel library progress notification after posting the result --- .../tachiyomi/data/library/LibraryUpdateService.kt | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt index e9a9d2e1bf..8b6c61eff7 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/library/LibraryUpdateService.kt @@ -289,7 +289,6 @@ class LibraryUpdateService( } // Notify result of the overall update. .doOnCompleted { - cancelProgressNotification() if (newUpdates.isNotEmpty()) { showResultNotification(newUpdates) if (downloadNew && hasDownloads) { @@ -300,6 +299,8 @@ class LibraryUpdateService( if (failedUpdates.isNotEmpty()) { Timber.e("Failed updating: ${failedUpdates.map { it.title }}") } + + cancelProgressNotification() } } @@ -389,10 +390,11 @@ class LibraryUpdateService( if (previousNotification != null) { val oldUpdates = previousNotification.notification.extras - .getString(Notification.EXTRA_BIG_TEXT, "") - .split("\n") + .getString(Notification.EXTRA_BIG_TEXT) - newUpdates += oldUpdates + if (!oldUpdates.isNullOrEmpty()) { + newUpdates += oldUpdates.split("\n") + } } }