Skip to content

Commit 2069ffd

Browse files
authored
Merge pull request #65 from vallemar/master
fix: cache
2 parents 1d5ca81 + 9f2357d commit 2069ffd

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/image/index.android.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ export function initialize(config?: ImagePipelineConfigSetting): void {
6666

6767
// this is needed for further buildKey to trigger ...
6868
com.bumptech.glide.Glide.with(context)
69-
.load('toto?ts=' + Date().valueOf())
70-
.apply(new com.bumptech.glide.request.RequestOptions().signature(new com.bumptech.glide.signature.ObjectKey(Date().valueOf())))
69+
.load('toto')
70+
.apply(new com.bumptech.glide.request.RequestOptions().signature(signature))
7171
.preload();
7272
// com.nativescript.image.EngineKeyFactoryMethodDumper.dumpKeyFactoryMethods(glideInstance);
7373
// com.nativescript.image.ForcePreloadTest.forcePreloadAfterInjection(context, 'https://example.com/test-image.png');
@@ -235,7 +235,10 @@ export class ImagePipeline {
235235
try {
236236
const context = Utils.android.getApplicationContext();
237237
const requestManager = com.bumptech.glide.Glide.with(context);
238-
const requestBuilder = requestManager.asBitmap().load(uri);
238+
const requestBuilder = requestManager
239+
.asBitmap()
240+
.load(uri)
241+
.apply(new com.bumptech.glide.request.RequestOptions().signature(signature));
239242

240243
let futureTarget = null;
241244
function clearLater() {
@@ -272,7 +275,9 @@ export class ImagePipeline {
272275
try {
273276
const context = Utils.android.getApplicationContext();
274277
const requestManager = com.bumptech.glide.Glide.with(context);
275-
const requestBuilder = toDiskCache ? requestManager.downloadOnly().load(uri) : requestManager.asBitmap().load(uri);
278+
const requestBuilder = (toDiskCache ? requestManager.downloadOnly().load(uri) : requestManager.asBitmap().load(uri)).apply(
279+
new com.bumptech.glide.request.RequestOptions().signature(signature)
280+
);
276281

277282
let futureTarget = null;
278283
function clearLater() {
@@ -636,7 +641,7 @@ export class Img extends ImageBase {
636641
this.loadSourceCallback // Can be null
637642
);
638643
}
639-
requestBuilder = com.bumptech.glide.Glide.with(context).load(loadModel).signature(new com.bumptech.glide.signature.ObjectKey(Date().valueOf()));
644+
requestBuilder = com.bumptech.glide.Glide.with(context).load(loadModel);
640645

641646
// Apply transformations (blur, rounded corners, etc.)
642647
const transformations = [];
@@ -817,7 +822,10 @@ export class Img extends ImageBase {
817822
target.setClearFirst(false);
818823
}
819824

820-
requestBuilder.signature(signature).listener(new com.nativescript.image.CompositeRequestListener(objectArr)).into(target);
825+
requestBuilder
826+
.apply(ro)
827+
.listener(new com.nativescript.image.CompositeRequestListener(objectArr))
828+
.into(target);
821829
}
822830

823831
private notifyLoadSource(source: string) {

0 commit comments

Comments
 (0)