Debounce reindexing banner
Helps avoid showing it for short-lived jobs (cherry picked from commit 5cc84403e1a6de956d7b3893893e792f88497d73)
This commit is contained in:
parent
12e12c5733
commit
a0fa323645
@ -22,6 +22,7 @@ import kotlinx.coroutines.awaitAll
|
|||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import kotlinx.coroutines.flow.SharingStarted
|
import kotlinx.coroutines.flow.SharingStarted
|
||||||
|
import kotlinx.coroutines.flow.debounce
|
||||||
import kotlinx.coroutines.flow.distinctUntilChanged
|
import kotlinx.coroutines.flow.distinctUntilChanged
|
||||||
import kotlinx.coroutines.flow.launchIn
|
import kotlinx.coroutines.flow.launchIn
|
||||||
import kotlinx.coroutines.flow.map
|
import kotlinx.coroutines.flow.map
|
||||||
@ -73,6 +74,7 @@ class DownloadCache(
|
|||||||
val isRenewing = changes
|
val isRenewing = changes
|
||||||
.map { renewalJob?.isActive ?: false }
|
.map { renewalJob?.isActive ?: false }
|
||||||
.distinctUntilChanged()
|
.distinctUntilChanged()
|
||||||
|
.debounce(1000L)
|
||||||
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
||||||
|
|
||||||
private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference())
|
private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference())
|
||||||
|
Loading…
x
Reference in New Issue
Block a user