From 5cc84403e1a6de956d7b3893893e792f88497d73 Mon Sep 17 00:00:00 2001 From: arkon Date: Mon, 2 Jan 2023 21:58:48 -0500 Subject: [PATCH] Debounce reindexing banner Helps avoid showing it for short-lived jobs --- .../java/eu/kanade/tachiyomi/data/download/DownloadCache.kt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 3c5dc6a57..dffc14bdb 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -22,6 +22,7 @@ import kotlinx.coroutines.awaitAll import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.delay import kotlinx.coroutines.flow.SharingStarted +import kotlinx.coroutines.flow.debounce import kotlinx.coroutines.flow.distinctUntilChanged import kotlinx.coroutines.flow.launchIn import kotlinx.coroutines.flow.map @@ -73,6 +74,7 @@ class DownloadCache( val isRenewing = changes .map { renewalJob?.isActive ?: false } .distinctUntilChanged() + .debounce(1000L) .stateIn(scope, SharingStarted.WhileSubscribed(), false) private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference())