From b6468c7e31728dcb888782d6cb11639833cfa037 Mon Sep 17 00:00:00 2001 From: arkon Date: Fri, 13 Jan 2023 18:40:59 -0500 Subject: [PATCH] Only how indexing downloads banner the first time Closes #8903 --- .../eu/kanade/tachiyomi/data/download/DownloadCache.kt | 8 +++++--- .../ui/browse/source/globalsearch/SearchScreenModel.kt | 1 - i18n/src/main/res/values/strings.xml | 3 +-- 3 files changed, 6 insertions(+), 6 deletions(-) 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 3cddfddd7f..1802a2da1f 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 @@ -31,12 +31,13 @@ import kotlinx.coroutines.flow.onStart import kotlinx.coroutines.flow.receiveAsFlow import kotlinx.coroutines.flow.shareIn import kotlinx.coroutines.flow.stateIn +import kotlinx.coroutines.flow.take import kotlinx.coroutines.withTimeout import logcat.LogPriority import uy.kohesive.injekt.Injekt import uy.kohesive.injekt.api.get import java.util.concurrent.ConcurrentHashMap -import java.util.concurrent.TimeUnit +import kotlin.time.Duration.Companion.hours import kotlin.time.Duration.Companion.seconds /** @@ -64,7 +65,7 @@ class DownloadCache( * The interval after which this cache should be invalidated. 1 hour shouldn't cause major * issues, as the cache is only used for UI feedback. */ - private val renewInterval = TimeUnit.HOURS.toMillis(1) + private val renewInterval = 1.hours.inWholeMilliseconds /** * The last time the cache was refreshed. @@ -74,7 +75,8 @@ class DownloadCache( val isRenewing = changes .map { renewalJob?.isActive ?: false } .distinctUntilChanged() - .debounce(1000L) + .take(2) // We only care about initial renewal + .debounce(1000L) // Don't notify if it finishes quickly enough .stateIn(scope, SharingStarted.WhileSubscribed(), false) private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference()) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt index bd959bdbbd..8304092f75 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/browse/source/globalsearch/SearchScreenModel.kt @@ -140,7 +140,6 @@ abstract class SearchScreenModel( async { try { val page = withContext(coroutineDispatcher) { - logcat { "Searching ${source.name}" } source.fetchSearchManga(1, query, source.getFilterList()).awaitSingle() } diff --git a/i18n/src/main/res/values/strings.xml b/i18n/src/main/res/values/strings.xml index 1b054b3869..cd541c66dd 100644 --- a/i18n/src/main/res/values/strings.xml +++ b/i18n/src/main/res/values/strings.xml @@ -898,7 +898,7 @@ Page %d not found while splitting Couldn\'t find file path of page %d Couldn\'t split downloaded image - Indexing downloads + Checking downloads Common @@ -909,7 +909,6 @@ Chapter updates App updates Extension updates - Indexing Crash logs