Add badge to bottom bar Updates tab indicating how many unread chapter updates are available (#5620)

Co-authored-by: arkon <arkon@users.noreply.github.com>
This commit is contained in:
Hunter Nickel
2021-10-30 10:32:51 -06:00
committed by GitHub
parent 00817aacfe
commit 459759bfe5
7 changed files with 31 additions and 0 deletions
@@ -291,6 +291,7 @@ class LibraryUpdateService(
val failedUpdates = CopyOnWriteArrayList<Pair<Manga, String?>>()
val hasDownloads = AtomicBoolean(false)
val loggedServices by lazy { trackManager.services.filter { it.isLogged } }
val currentUnreadUpdatesCount = preferences.libraryUnreadUpdatesCount().get()
withIOContext {
mangaToUpdate.groupBy { it.source }
@@ -354,6 +355,8 @@ class LibraryUpdateService(
if (newUpdates.isNotEmpty()) {
notifier.showUpdateNotifications(newUpdates)
val newChapterCount = newUpdates.sumOf { it.second.size }
preferences.libraryUnreadUpdatesCount().set(currentUnreadUpdatesCount + newChapterCount)
if (hasDownloads.get()) {
DownloadService.start(this)
}