SIGN IN SIGN UP

fix(android): share OkHttpClient and ImageLoader across image loads (#443)

Every reloadImage() built a new OkHttpClient and a new Coil ImageLoader
to attach a view-specific ProgressInterceptor. Each ImageLoader registers
a ConnectivityManager network callback; Android caps an app at 100, so
rendering ~100 images crashes with a fatal TooManyRequestsException.
Each OkHttpClient also owns its own thread + connection pool, causing
memory bloat under image-heavy scrolling.

Fix: one shared OkHttpClient and at most two shared ImageLoaders (one
per respectCacheHeaders value). onProgress is preserved: each request is
tagged with the view tag via an internal header that ProgressInterceptor
strips before the request hits the network, and the matching listener is
resolved from a ConcurrentHashMap registry (registered on load,
unregistered in onDropViewInstance).

Fixes #440

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
Co-authored-by: duguyihou <duguyihou@gmail.com>
A
Ashish Mishra committed
65d2c2b5351db077f3f3bdebabc93a01904eeae1
Parent: 1219729
Committed by GitHub <noreply@github.com> on 7/23/2026, 3:16:31 AM