@nativescript-community/ui-image 4.3.22 → 4.3.23
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/index-common.js +1 -1
- package/index.android.d.ts +1 -0
- package/index.android.js +13 -6
- package/index.d.ts +2 -0
- package/index.ios.d.ts +7 -5
- package/index.ios.js +26 -20
- package/package.json +2 -2
- package/platforms/android/ui_image.aar +0 -0
- package/platforms/ios/Podfile +1 -1
- package/vue/index.mjs +8 -0
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,12 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [4.3.23](https://github.com/nativescript-community/ui-image/compare/v4.3.22...v4.3.23) (2023-11-22)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* **ios:** updated native dep ([e6cc5f5](https://github.com/nativescript-community/ui-image/commit/e6cc5f5e0d42f048acbf37d0f8b936f138326b78))
|
11
|
+
|
6
12
|
## [4.3.22](https://github.com/nativescript-community/ui-image/compare/v4.3.21...v4.3.22) (2023-11-17)
|
7
13
|
|
8
14
|
### Bug Fixes
|
package/index-common.js
CHANGED
@@ -94,7 +94,7 @@ export const srcProperty = new Property({ name: 'src' });
|
|
94
94
|
export const lowerResSrcProperty = new Property({ name: 'lowerResSrc' });
|
95
95
|
export const placeholderImageUriProperty = new Property({ name: 'placeholderImageUri' });
|
96
96
|
export const failureImageUriProperty = new Property({ name: 'failureImageUri' });
|
97
|
-
export const stretchProperty = new Property({ name: 'stretch'
|
97
|
+
export const stretchProperty = new Property({ name: 'stretch' });
|
98
98
|
export const backgroundUriProperty = new Property({ name: 'backgroundUri' });
|
99
99
|
export const progressiveRenderingEnabledProperty = new Property({ name: 'progressiveRenderingEnabled', valueConverter: booleanConverter });
|
100
100
|
export const localThumbnailPreviewsEnabledProperty = new Property({ name: 'localThumbnailPreviewsEnabled', valueConverter: booleanConverter });
|
package/index.android.d.ts
CHANGED
@@ -74,6 +74,7 @@ export declare class Img extends ImageBase {
|
|
74
74
|
createNativeView(): com.nativescript.image.DraweeView;
|
75
75
|
updateViewSize(imageInfo: any): void;
|
76
76
|
disposeNativeView(): void;
|
77
|
+
get cacheKey(): string | globalAndroid.net.Uri;
|
77
78
|
updateImageUri(): void;
|
78
79
|
controllerListener: com.facebook.drawee.controller.ControllerListener<com.facebook.imagepipeline.image.ImageInfo>;
|
79
80
|
protected initImage(): Promise<void>;
|
package/index.android.js
CHANGED
@@ -353,15 +353,22 @@ export class Img extends ImageBase {
|
|
353
353
|
this.controllerListener = null;
|
354
354
|
// this.nativeImageViewProtected.setImageURI(null, null);
|
355
355
|
}
|
356
|
+
get cacheKey() {
|
357
|
+
const src = this.src;
|
358
|
+
if (src && !(src instanceof ImageSource)) {
|
359
|
+
return getUri(src);
|
360
|
+
}
|
361
|
+
return undefined;
|
362
|
+
}
|
356
363
|
updateImageUri() {
|
357
364
|
const imagePipeLine = getImagePipeline();
|
365
|
+
const cacheKey = this.cacheKey;
|
358
366
|
const src = this.src;
|
359
|
-
if (
|
360
|
-
const
|
361
|
-
|
362
|
-
|
363
|
-
|
364
|
-
}
|
367
|
+
if (cacheKey) {
|
368
|
+
// const isInCache = imagePipeLine.isInBitmapMemoryCache(uri);
|
369
|
+
// // if (isInCache) {
|
370
|
+
imagePipeLine.evictFromCache(cacheKey);
|
371
|
+
// }
|
365
372
|
}
|
366
373
|
this.src = null;
|
367
374
|
this.src = src;
|
package/index.d.ts
CHANGED
package/index.ios.d.ts
CHANGED
@@ -17,11 +17,11 @@ export declare class ImagePipeline {
|
|
17
17
|
private mIos;
|
18
18
|
constructor();
|
19
19
|
getCacheKey(uri: string, context: any): string;
|
20
|
-
isInDiskCache(
|
21
|
-
isInBitmapMemoryCache(
|
22
|
-
evictFromMemoryCache(
|
23
|
-
evictFromDiskCache(
|
24
|
-
evictFromCache(
|
20
|
+
isInDiskCache(key: string): boolean;
|
21
|
+
isInBitmapMemoryCache(key: string): boolean;
|
22
|
+
evictFromMemoryCache(key: string): void;
|
23
|
+
evictFromDiskCache(key: string): void;
|
24
|
+
evictFromCache(key: string): void;
|
25
25
|
clearCaches(): void;
|
26
26
|
clearMemoryCaches(): void;
|
27
27
|
clearDiskCaches(): void;
|
@@ -36,6 +36,8 @@ export declare class Img extends ImageBase {
|
|
36
36
|
nativeViewProtected: SDAnimatedImageView | UIImageView;
|
37
37
|
nativeImageViewProtected: SDAnimatedImageView | UIImageView;
|
38
38
|
isLoading: boolean;
|
39
|
+
mCacheKey: string;
|
40
|
+
get cacheKey(): string;
|
39
41
|
protected mImageSourceAffectsLayout: boolean;
|
40
42
|
protected mCIFilter: CIFilter;
|
41
43
|
createNativeView(): UIImageView;
|
package/index.ios.js
CHANGED
@@ -80,20 +80,20 @@ export class ImagePipeline {
|
|
80
80
|
getCacheKey(uri, context) {
|
81
81
|
return SDWebImageManager.sharedManager.cacheKeyForURLContext(NSURL.URLWithString(uri), context);
|
82
82
|
}
|
83
|
-
isInDiskCache(
|
84
|
-
return this.mIos.diskImageDataExistsWithKey(
|
83
|
+
isInDiskCache(key) {
|
84
|
+
return this.mIos.diskImageDataExistsWithKey(key);
|
85
85
|
}
|
86
|
-
isInBitmapMemoryCache(
|
87
|
-
return this.mIos.imageFromMemoryCacheForKey(
|
86
|
+
isInBitmapMemoryCache(key) {
|
87
|
+
return this.mIos.imageFromMemoryCacheForKey(key) !== null;
|
88
88
|
}
|
89
|
-
evictFromMemoryCache(
|
90
|
-
this.mIos.removeImageFromMemoryForKey(
|
89
|
+
evictFromMemoryCache(key) {
|
90
|
+
this.mIos.removeImageFromMemoryForKey(key);
|
91
91
|
}
|
92
|
-
evictFromDiskCache(
|
93
|
-
this.mIos.removeImageFromDiskForKey(
|
92
|
+
evictFromDiskCache(key) {
|
93
|
+
this.mIos.removeImageFromDiskForKey(key);
|
94
94
|
}
|
95
|
-
evictFromCache(
|
96
|
-
const key = getUri(uri).absoluteString;
|
95
|
+
evictFromCache(key) {
|
96
|
+
// const key = getUri(uri).absoluteString;
|
97
97
|
this.mIos.removeImageFromDiskForKey(key);
|
98
98
|
this.mIos.removeImageFromMemoryForKey(key);
|
99
99
|
// this.mIos.removeImageForKeyWithCompletion(getUri(uri).absoluteString, null);
|
@@ -221,6 +221,9 @@ export class Img extends ImageBase {
|
|
221
221
|
this.handleImageProgress(totalSize > 0 ? currentSize / totalSize : -1, totalSize);
|
222
222
|
};
|
223
223
|
}
|
224
|
+
get cacheKey() {
|
225
|
+
return this.mCacheKey;
|
226
|
+
}
|
224
227
|
createNativeView() {
|
225
228
|
const result = this.animatedImageView ? SDAnimatedImageView.new() : UIImageView.new();
|
226
229
|
result.contentMode = 1 /* UIViewContentMode.ScaleAspectFit */;
|
@@ -243,9 +246,9 @@ export class Img extends ImageBase {
|
|
243
246
|
const finiteWidth = widthMode === layout.EXACTLY;
|
244
247
|
const finiteHeight = heightMode === layout.EXACTLY;
|
245
248
|
this.mImageSourceAffectsLayout = !finiteWidth || !finiteHeight;
|
246
|
-
if (Trace.isEnabled()) {
|
247
|
-
|
248
|
-
}
|
249
|
+
// if (Trace.isEnabled()) {
|
250
|
+
// CLog(CLogTypes.info, 'onMeasure', this.src, widthMeasureSpec, heightMeasureSpec, width, height, this.aspectRatio, image && image.imageOrientation);
|
251
|
+
// }
|
249
252
|
if (image || this.aspectRatio > 0) {
|
250
253
|
const nativeWidth = image ? layout.toDevicePixels(image.size.width) : 0;
|
251
254
|
const nativeHeight = image ? layout.toDevicePixels(image.size.height) : 0;
|
@@ -270,7 +273,7 @@ export class Img extends ImageBase {
|
|
270
273
|
}
|
271
274
|
}
|
272
275
|
if (Trace.isEnabled()) {
|
273
|
-
CLog(CLogTypes.info, 'onMeasure
|
276
|
+
CLog(CLogTypes.info, 'onMeasure', this.src, this.aspectRatio, finiteWidth, finiteHeight, width, height, nativeWidth, nativeHeight, widthMeasureSpec, heightMeasureSpec);
|
274
277
|
}
|
275
278
|
}
|
276
279
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
@@ -279,13 +282,15 @@ export class Img extends ImageBase {
|
|
279
282
|
const imagePipeLine = getImagePipeline();
|
280
283
|
const src = this.src;
|
281
284
|
if (!(src instanceof ImageSource)) {
|
282
|
-
const
|
283
|
-
const isInCache = imagePipeLine.isInBitmapMemoryCache(
|
284
|
-
if (isInCache) {
|
285
|
-
|
286
|
-
}
|
285
|
+
const cachekKey = this.mCacheKey || getUri(src).absoluteString;
|
286
|
+
// const isInCache = imagePipeLine.isInBitmapMemoryCache(cachekKey);
|
287
|
+
// if (isInCache) {
|
288
|
+
imagePipeLine.evictFromCache(cachekKey);
|
289
|
+
// }
|
287
290
|
}
|
288
291
|
this.src = null;
|
292
|
+
// ensure we clear the image as
|
293
|
+
this._setNativeImage(null, false);
|
289
294
|
this.src = src;
|
290
295
|
}
|
291
296
|
_setNativeImage(nativeImage, animated = true) {
|
@@ -317,7 +322,7 @@ export class Img extends ImageBase {
|
|
317
322
|
this.nativeImageViewProtected.image = nativeImage;
|
318
323
|
}
|
319
324
|
if (this.mImageSourceAffectsLayout) {
|
320
|
-
this.mImageSourceAffectsLayout = false;
|
325
|
+
// this.mImageSourceAffectsLayout = false;
|
321
326
|
this.requestLayout();
|
322
327
|
}
|
323
328
|
}
|
@@ -419,6 +424,7 @@ export class Img extends ImageBase {
|
|
419
424
|
}
|
420
425
|
context.setValueForKey(SDImagePipelineTransformer.transformerWithTransformers(transformers), SDWebImageContextImageTransformer);
|
421
426
|
}
|
427
|
+
this.mCacheKey = SDWebImageManager.sharedManager.cacheKeyForURLContext(uri, context);
|
422
428
|
this.nativeImageViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(uri, this.placeholderImage, options, context, this.onLoadProgress, this.handleImageLoaded);
|
423
429
|
}
|
424
430
|
else if (this.placeholderImage) {
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-image",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.23",
|
4
4
|
"description": "Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
@@ -44,5 +44,5 @@
|
|
44
44
|
},
|
45
45
|
"license": "Apache-2.0",
|
46
46
|
"readmeFilename": "README.md",
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "2a74cda73128571c05d0e636aefe40be63c8d3eb"
|
48
48
|
}
|
Binary file
|
package/platforms/ios/Podfile
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
pod 'SDWebImage', '>= 5.
|
1
|
+
pod 'SDWebImage', '>= 5.18.5.0'
|
2
2
|
pod 'SDWebImagePhotosPlugin'
|