Only how indexing downloads banner the first time

Closes #8903
This commit is contained in:
arkon 2023-01-13 18:40:59 -05:00
parent 1967923a94
commit b6468c7e31
3 changed files with 6 additions and 6 deletions

View file

@ -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())

View file

@ -140,7 +140,6 @@ abstract class SearchScreenModel<T>(
async {
try {
val page = withContext(coroutineDispatcher) {
logcat { "Searching ${source.name}" }
source.fetchSearchManga(1, query, source.getFilterList()).awaitSingle()
}

View file

@ -898,7 +898,7 @@
<string name="download_notifier_split_page_not_found">Page %d not found while splitting</string>
<string name="download_notifier_split_page_path_not_found">Couldn\'t find file path of page %d</string>
<string name="download_notifier_split_failed">Couldn\'t split downloaded image</string>
<string name="download_notifier_cache_renewal">Indexing downloads</string>
<string name="download_notifier_cache_renewal">Checking downloads</string>
<!-- Notification channels -->
<string name="channel_common">Common</string>
@ -909,7 +909,6 @@
<string name="channel_new_chapters">Chapter updates</string>
<string name="channel_app_updates">App updates</string>
<string name="channel_ext_updates">Extension updates</string>
<string name="channel_downloader_cache">Indexing</string>
<string name="channel_crash_logs">Crash logs</string>
<!-- S Pen actions -->