mirror of
https://github.com/mihonapp/mihon.git
synced 2024-12-01 13:34:18 -05:00
parent
1967923a94
commit
b6468c7e31
3 changed files with 6 additions and 6 deletions
|
@ -31,12 +31,13 @@ import kotlinx.coroutines.flow.onStart
|
||||||
import kotlinx.coroutines.flow.receiveAsFlow
|
import kotlinx.coroutines.flow.receiveAsFlow
|
||||||
import kotlinx.coroutines.flow.shareIn
|
import kotlinx.coroutines.flow.shareIn
|
||||||
import kotlinx.coroutines.flow.stateIn
|
import kotlinx.coroutines.flow.stateIn
|
||||||
|
import kotlinx.coroutines.flow.take
|
||||||
import kotlinx.coroutines.withTimeout
|
import kotlinx.coroutines.withTimeout
|
||||||
import logcat.LogPriority
|
import logcat.LogPriority
|
||||||
import uy.kohesive.injekt.Injekt
|
import uy.kohesive.injekt.Injekt
|
||||||
import uy.kohesive.injekt.api.get
|
import uy.kohesive.injekt.api.get
|
||||||
import java.util.concurrent.ConcurrentHashMap
|
import java.util.concurrent.ConcurrentHashMap
|
||||||
import java.util.concurrent.TimeUnit
|
import kotlin.time.Duration.Companion.hours
|
||||||
import kotlin.time.Duration.Companion.seconds
|
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
|
* 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.
|
* 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.
|
* The last time the cache was refreshed.
|
||||||
|
@ -74,7 +75,8 @@ class DownloadCache(
|
||||||
val isRenewing = changes
|
val isRenewing = changes
|
||||||
.map { renewalJob?.isActive ?: false }
|
.map { renewalJob?.isActive ?: false }
|
||||||
.distinctUntilChanged()
|
.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)
|
.stateIn(scope, SharingStarted.WhileSubscribed(), false)
|
||||||
|
|
||||||
private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference())
|
private var rootDownloadsDir = RootDirectory(getDirectoryFromPreference())
|
||||||
|
|
|
@ -140,7 +140,6 @@ abstract class SearchScreenModel<T>(
|
||||||
async {
|
async {
|
||||||
try {
|
try {
|
||||||
val page = withContext(coroutineDispatcher) {
|
val page = withContext(coroutineDispatcher) {
|
||||||
logcat { "Searching ${source.name}" }
|
|
||||||
source.fetchSearchManga(1, query, source.getFilterList()).awaitSingle()
|
source.fetchSearchManga(1, query, source.getFilterList()).awaitSingle()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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_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_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_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 -->
|
<!-- Notification channels -->
|
||||||
<string name="channel_common">Common</string>
|
<string name="channel_common">Common</string>
|
||||||
|
@ -909,7 +909,6 @@
|
||||||
<string name="channel_new_chapters">Chapter updates</string>
|
<string name="channel_new_chapters">Chapter updates</string>
|
||||||
<string name="channel_app_updates">App updates</string>
|
<string name="channel_app_updates">App updates</string>
|
||||||
<string name="channel_ext_updates">Extension 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>
|
<string name="channel_crash_logs">Crash logs</string>
|
||||||
|
|
||||||
<!-- S Pen actions -->
|
<!-- S Pen actions -->
|
||||||
|
|
Loading…
Reference in a new issue