news-android
news-android copied to clipboard
use okhttp client for caching (instead of glide)
This MR disables Glides Caching and uses OkHttp's caching instead. The reason is that Glide does not care about ETags and Last-Modified Headers. Once a URL is in the cache it stays there. See: https://github.com/bumptech/glide/issues/1847
Fixes https://github.com/nextcloud/news-android/issues/1247
Changes:
- Glide cache is now only 10mb as it is supposed to be used only for favicons
- Default
DiskCacheStrategyis nowNONE- only favicons override this setting - OkHttp has a Cache now (which has the size of what's configured in the app settings - by default 500mb)
TODO:
- Offline caching of images does not currently work (see todo in code)
- Injecting images into articles from cache currently does not work (as the cache check only checks the glide cache - not the okhttp cache)
@tobiasKaminsky FYI - I saw that you were involved in the dicussion in https://github.com/bumptech/glide/issues/1847. I think by using the OkHttp Client we can get around the issues with ETags / Last-Modfied without having to initiate a separate http request. But then again... this requires OkHttp which you are not using in the files app yet, eh?
Nice idea! On Files we slowly switch to okhttp3, so this can then be a way to go.