Adjust update/download warnings

- Uses toasts now
- Adjusted wording to emphasize effect on sources
- Download warning has a different threshold (15 chapters per source, vs. 60 entries per source for library update)
This commit is contained in:
arkon
2021-10-18 10:46:07 -04:00
parent f453236840
commit 538dd60580
6 changed files with 17 additions and 26 deletions
@@ -88,20 +88,6 @@ 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.
*
@@ -5,6 +5,7 @@ import android.content.Context
import android.content.Intent
import android.os.IBinder
import android.os.PowerManager
import android.widget.Toast
import androidx.core.content.ContextCompat
import eu.kanade.tachiyomi.R
import eu.kanade.tachiyomi.data.cache.CoverCache
@@ -38,6 +39,7 @@ import eu.kanade.tachiyomi.util.system.acquireWakeLock
import eu.kanade.tachiyomi.util.system.createFileInCacheDir
import eu.kanade.tachiyomi.util.system.isServiceRunning
import eu.kanade.tachiyomi.util.system.logcat
import eu.kanade.tachiyomi.util.system.toast
import kotlinx.coroutines.CoroutineExceptionHandler
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@@ -267,8 +269,8 @@ class LibraryUpdateService(
// Warn when excessively checking a single source
val maxUpdatesFromSource = mangaToUpdate.groupBy { it.source }.maxOf { it.value.size }
if (maxUpdatesFromSource > PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
notifier.showQueueSizeWarningNotification()
if (maxUpdatesFromSource > MANGA_PER_SOURCE_QUEUE_WARNING_THRESHOLD) {
toast(R.string.notification_size_warning, Toast.LENGTH_LONG)
}
}
@@ -574,4 +576,4 @@ class LibraryUpdateService(
}
}
const val PER_SOURCE_QUEUE_WARNING_THRESHOLD = 60
private const val MANGA_PER_SOURCE_QUEUE_WARNING_THRESHOLD = 60