Add warnings when library and download queues are considered large (closes #5950)

Arbitrarily set at a size of 100 for now. We could adjust this in the future as appropriate if needed.
This commit is contained in:
arkon
2021-10-09 14:55:21 -04:00
parent 9106fc5b94
commit 082eef708f
7 changed files with 33 additions and 6 deletions
@@ -88,6 +88,20 @@ class LibraryUpdateNotifier(private val context: Context) {
)
}
fun showQueueSizeWarningNotification() {
val notification = context.notificationBuilder(Notifications.CHANNEL_LIBRARY_PROGRESS) {
setContentTitle(context.getString(R.string.label_warning))
setSmallIcon(R.drawable.ic_warning_white_24dp)
setStyle(NotificationCompat.BigTextStyle().bigText(context.getString(R.string.notification_size_warning)))
}
.build()
context.notificationManager.notify(
Notifications.ID_LIBRARY_SIZE_WARNING,
notification,
)
}
/**
* Shows notification containing update entries that failed with action to open full log.
*
@@ -264,6 +264,10 @@ class LibraryUpdateService(
mangaToUpdate = listToUpdate
.distinctBy { it.id }
.sortedWith(rankingScheme[selectedScheme])
if (mangaToUpdate.size > QUEUE_SIZE_WARNING_THRESHOLD) {
notifier.showQueueSizeWarningNotification()
}
}
/**
@@ -567,3 +571,5 @@ class LibraryUpdateService(
return File("")
}
}
const val QUEUE_SIZE_WARNING_THRESHOLD = 100