image-cache: rewrite URLs eagerly, download lazily via scheme handler
process() was downloading all images before returning, blocking the article list update for potentially minutes on a first run or after a cache wipe. Move all network I/O out of process(): - process() now only rewrites src="https://..." to the custom feedthemonkey-img:/// scheme — it is synchronous and instant. - The URI scheme handler already downloads and caches on demand, so images are fetched the first time the WebView requests them and served from disk on every subsequent view. This means the article list appears immediately after a server fetch regardless of how many images need caching.
This commit is contained in:
parent
00700c3211
commit
3f759bce2e
2 changed files with 20 additions and 40 deletions
|
|
@ -597,7 +597,7 @@ pub mod imp {
|
|||
async move {
|
||||
let articles = api.fetch_unread().await?;
|
||||
let articles = if cache_images {
|
||||
crate::image_cache::process(articles).await
|
||||
crate::image_cache::process(articles)
|
||||
} else {
|
||||
articles
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue