mirror of
https://github.com/mihonapp/mihon.git
synced 2025-06-27 03:27:51 +02:00
Add option to invalidate download cache (#8491)
* Add option to invalidate download cache * Review changes + lint
This commit is contained in:
@ -31,6 +31,7 @@ import eu.kanade.presentation.more.settings.Preference
|
||||
import eu.kanade.presentation.util.collectAsState
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.cache.ChapterCache
|
||||
import eu.kanade.tachiyomi.data.download.DownloadCache
|
||||
import eu.kanade.tachiyomi.data.library.LibraryUpdateService
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues
|
||||
import eu.kanade.tachiyomi.data.track.TrackManager
|
||||
@ -187,6 +188,11 @@ class SettingsAdvancedScreen : SearchableSettings {
|
||||
pref = libraryPreferences.autoClearChapterCache(),
|
||||
title = stringResource(R.string.pref_auto_clear_chapter_cache),
|
||||
),
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = stringResource(R.string.pref_invalidate_download_cache),
|
||||
subtitle = stringResource(R.string.pref_invalidate_download_cache_summary),
|
||||
onClick = { Injekt.get<DownloadCache>().invalidateCache() },
|
||||
),
|
||||
Preference.PreferenceItem.TextPreference(
|
||||
title = stringResource(R.string.pref_clear_database),
|
||||
subtitle = stringResource(R.string.pref_clear_database_summary),
|
||||
|
@ -233,6 +233,10 @@ class DownloadCache(
|
||||
return UniFile.fromUri(context, dir.toUri())
|
||||
}
|
||||
|
||||
fun invalidateCache() {
|
||||
lastRenew = 0L
|
||||
}
|
||||
|
||||
/**
|
||||
* Renews the downloads cache.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user