Skip to content

Commit 48d4562

Browse files
committed
fix(android): not reloading image although etag changed
1 parent 4511ace commit 48d4562

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

android/src/main/java/com/dylanvann/fastimage/FastImageViewManager.java

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -163,13 +163,13 @@ private void loadImage(final FastImageViewWithUrl view, final String url, @Nulla
163163
String prevEtag = ObjectBox.getEtagByUrl(url);
164164

165165
// We need to make a head request to the URL with the ETAG attached.
166-
// - When we get a new etag Glide will send out another request
167-
// - If the signature (etag) doesn't change, Glide won't bother sending out a request
166+
// - When we get a new etag Glide will send out another request (as signature has changed)
167+
// - If the signature (etag) didn't change, Glide won't bother sending out a request
168168
EtagRequester.requestEtag(url, prevEtag, new EtagCallback() {
169169
@Override
170170
public void onEtag(String etag) {
171171
// Note: here at this point the etag in the ObjectBox has been updated
172-
// to the new etag. That's why we pass down the the previous.
172+
// to the new etag. That's why we pass down the the previous reference.
173173
loadImageWithSignature(view, url, etag, prevEtag, options, key);
174174
}
175175

@@ -219,9 +219,11 @@ private void loadImageWithSignature(
219219
.load(url);
220220
thumbnailRequest = thumbnailRequest.signature(new ObjectKey(prevSignature));
221221
imageRequest = imageRequest
222-
.thumbnail(thumbnailRequest)
223-
.skipMemoryCache(true);
222+
.thumbnail(thumbnailRequest);
224223
}
224+
// important: otherwise it may take the memory cache image for the
225+
// same url and save that as new result for the new signature
226+
imageRequest = imageRequest.skipMemoryCache(true);
225227

226228
if (signature != null) {
227229
imageRequest = imageRequest.signature(new ObjectKey(signature));

0 commit comments

Comments
 (0)