fix(notifications): paused notifications not showing (#1468)

* fix(notifications): paused notifications not showing

* docs(notifications): clarify notification dismissal and add comment for paused notifications

* refactor

---------

Co-authored-by: Cuong-Tran <16017808+cuong-tran@users.noreply.github.com>
This commit is contained in:
Syabit 2026-02-10 13:54:36 +07:00 committed by GitHub
parent b68444f3cb
commit dd3b19fa89
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 22 additions and 3 deletions

View file

@ -61,11 +61,21 @@ internal class DownloadNotifier(private val context: Context) {
}
/**
* Dismiss the downloader's notification. Downloader error notifications use a different id, so
* those can only be dismissed by the user.
* Dismiss the downloader's progress and paused notifications. Error notifications use a
* different id, so those can only be dismissed by the user.
*/
fun dismissProgress() {
context.cancelNotification(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
// KMK -->
context.cancelNotification(Notifications.ID_DOWNLOAD_CHAPTER_PAUSED)
}
/**
* Dismiss the pause notification. Called when resuming downloads.
*/
fun dismissPaused() {
context.cancelNotification(Notifications.ID_DOWNLOAD_CHAPTER_PAUSED)
// KMK <--
}
/**
@ -147,7 +157,9 @@ internal class DownloadNotifier(private val context: Context) {
NotificationReceiver.clearDownloadsPendingBroadcast(context),
)
show(Notifications.ID_DOWNLOAD_CHAPTER_PROGRESS)
// KMK -->
show(Notifications.ID_DOWNLOAD_CHAPTER_PAUSED)
// KMK <--
}
// Reset initial values

View file

@ -139,6 +139,10 @@ class Downloader(
return false
}
// KMK -->
notifier.dismissPaused()
// KMK <--
val pending = queueState.value.filter { it.status != Download.State.DOWNLOADED }
pending.forEach { if (it.status != Download.State.QUEUE) it.status = Download.State.QUEUE }

View file

@ -42,6 +42,9 @@ object Notifications {
private const val GROUP_DOWNLOADER = "group_downloader"
const val CHANNEL_DOWNLOADER_PROGRESS = "downloader_progress_channel"
const val ID_DOWNLOAD_CHAPTER_PROGRESS = -201
// KMK -->
const val ID_DOWNLOAD_CHAPTER_PAUSED = -203
// KMK <--
const val CHANNEL_DOWNLOADER_ERROR = "downloader_error_channel"
const val ID_DOWNLOAD_CHAPTER_ERROR = -202