@nativescript-community/ui-image 4.0.32 → 4.1.1

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 CHANGED
@@ -3,6 +3,44 @@
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.1.1](https://github.com/nativescript-community/ui-image/compare/v4.1.0...v4.1.1) (2021-12-23)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * android remove dep on annotationx ([c9fdfbe](https://github.com/nativescript-community/ui-image/commit/c9fdfbe8f7c7f876abb53b1d8b9b7c68d65ae21f))
12
+
13
+
14
+
15
+
16
+
17
+ # [4.1.0](https://github.com/nativescript-community/ui-image/compare/v4.0.34...v4.1.0) (2021-10-21)
18
+
19
+
20
+ ### Features
21
+
22
+ * **android:** native-api-usage ([0ec235c](https://github.com/nativescript-community/ui-image/commit/0ec235c2df1d5c4f6f30615766ea17ba74576dc7))
23
+
24
+
25
+
26
+
27
+
28
+ ## [4.0.34](https://github.com/nativescript-community/ui-image/compare/v4.0.33...v4.0.34) (2021-10-15)
29
+
30
+ **Note:** Version bump only for package @nativescript-community/ui-image
31
+
32
+
33
+
34
+
35
+
36
+ ## [4.0.33](https://github.com/nativescript-community/ui-image/compare/v4.0.32...v4.0.33) (2021-10-08)
37
+
38
+ **Note:** Version bump only for package @nativescript-community/ui-image
39
+
40
+
41
+
42
+
43
+
6
44
  ## [4.0.32](https://github.com/nativescript-community/ui-image/compare/v4.0.31...v4.0.32) (2021-10-08)
7
45
 
8
46
  **Note:** Version bump only for package @nativescript-community/ui-image
package/image-common.d.ts CHANGED
@@ -41,6 +41,7 @@ export interface ImageError {
41
41
  }
42
42
  export interface ImagePipelineConfigSetting {
43
43
  isDownsampleEnabled?: boolean;
44
+ leakTracker?: any;
44
45
  }
45
46
  export declare class EventData implements IEventData {
46
47
  private _eventName;
package/image.android.js CHANGED
@@ -18,9 +18,13 @@ export function initialize(config) {
18
18
  if (config && config.isDownsampleEnabled) {
19
19
  builder.setDownsampleEnabled(true);
20
20
  }
21
+ if (config && config.leakTracker) {
22
+ builder.setCloseableReferenceLeakTracker(config.leakTracker);
23
+ }
21
24
  const imagePipelineConfig = builder.build();
22
25
  com.facebook.drawee.backends.pipeline.Fresco.initialize(context, imagePipelineConfig);
23
26
  initialized = true;
27
+ initializeConfig = null;
24
28
  }
25
29
  }
26
30
  export function getImagePipeline() {
package/image.ios.d.ts CHANGED
@@ -38,7 +38,7 @@ export declare class Img extends ImageBase {
38
38
  _setNativeClipToBounds(): void;
39
39
  onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
40
40
  updateImageUri(): void;
41
- _setNativeImage(nativeImage: UIImage): void;
41
+ _setNativeImage(nativeImage: UIImage, animated?: boolean): void;
42
42
  private handleImageLoaded;
43
43
  private onLoadProgress;
44
44
  private getUIImage;
package/image.ios.js CHANGED
@@ -201,17 +201,9 @@ export class Img extends ImageBase {
201
201
  this._imageSourceAffectsLayout = true;
202
202
  this.handleImageLoaded = (image, error, cacheType) => {
203
203
  this.isLoading = false;
204
+ const animate = (this.alwaysFade || cacheType !== 2) && this.fadeDuration > 0;
204
205
  if (image) {
205
- if ((this.alwaysFade || cacheType !== 2) && this.fadeDuration > 0) {
206
- this.nativeViewProtected.alpha = 0.0;
207
- this._setNativeImage(image);
208
- UIView.animateWithDurationAnimations(this.fadeDuration / 1000, () => {
209
- this.nativeViewProtected.alpha = this.opacity;
210
- });
211
- }
212
- else {
213
- this._setNativeImage(image);
214
- }
206
+ this._setNativeImage(image, animate);
215
207
  }
216
208
  if (!this.autoPlayAnimations) {
217
209
  this.nativeViewProtected.stopAnimating();
@@ -225,7 +217,7 @@ export class Img extends ImageBase {
225
217
  this.notify(args);
226
218
  if (this.failureImageUri) {
227
219
  image = this.getUIImage(this.failureImageUri);
228
- this._setNativeImage(image);
220
+ this._setNativeImage(image, animate);
229
221
  }
230
222
  }
231
223
  else if (image) {
@@ -296,8 +288,17 @@ export class Img extends ImageBase {
296
288
  this.src = null;
297
289
  this.src = src;
298
290
  }
299
- _setNativeImage(nativeImage) {
300
- this.nativeViewProtected.image = nativeImage;
291
+ _setNativeImage(nativeImage, animated = true) {
292
+ if (animated) {
293
+ this.nativeViewProtected.alpha = 0.0;
294
+ this.nativeViewProtected.image = nativeImage;
295
+ UIView.animateWithDurationAnimations(this.fadeDuration / 1000, () => {
296
+ this.nativeViewProtected.alpha = this.opacity;
297
+ });
298
+ }
299
+ else {
300
+ this.nativeViewProtected.image = nativeImage;
301
+ }
301
302
  if (this._imageSourceAffectsLayout) {
302
303
  this._imageSourceAffectsLayout = false;
303
304
  this.requestLayout();
@@ -333,8 +334,9 @@ export class Img extends ImageBase {
333
334
  if (this.nativeViewProtected) {
334
335
  const src = this.src;
335
336
  if (src) {
337
+ const animate = this.fadeDuration > 0;
336
338
  if (src instanceof ImageSource) {
337
- this._setNativeImage(src.ios);
339
+ this._setNativeImage(src.ios, animate);
338
340
  return;
339
341
  }
340
342
  else if (typeof src === 'string') {
@@ -343,7 +345,7 @@ export class Img extends ImageBase {
343
345
  if (fontIconCode !== undefined) {
344
346
  const font = this.style.fontInternal;
345
347
  const color = this.style.color;
346
- this._setNativeImage(ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios);
348
+ this._setNativeImage(ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios, animate);
347
349
  }
348
350
  return;
349
351
  }
@@ -387,6 +389,9 @@ export class Img extends ImageBase {
387
389
  }
388
390
  this.nativeViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(uri, this.placeholderImage, options, context, this.onLoadProgress, this.handleImageLoaded);
389
391
  }
392
+ else if (this.placeholderImage) {
393
+ this._setNativeImage(this.placeholderImage);
394
+ }
390
395
  else {
391
396
  this._setNativeImage(null);
392
397
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.0.32",
3
+ "version": "4.1.1",
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": "./image",
6
6
  "sideEffects": false,
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "license": "Apache-2.0",
38
38
  "readmeFilename": "README.md",
39
- "gitHead": "b6fe5203d463683f1cb1c4435466825f54316e51"
39
+ "gitHead": "c7d280737dc5545b82039bf08cbd7631ef4cd7a5"
40
40
  }
File without changes
@@ -0,0 +1,2 @@
1
+ #Thu Dec 23 15:59:45 CET 2021
2
+ gradle.version=6.4
File without changes
@@ -10,12 +10,16 @@ dependencies {
10
10
  implementation("com.facebook.fresco:fresco:$frescoVersion") {
11
11
  exclude group: 'com.facebook.soloader', module: 'soloader'
12
12
  exclude group: 'com.facebook.fresco', module: 'soloader'
13
+ exclude group: 'com.facebook.fresco', module: 'nativeimagefilters'
14
+ exclude group: 'com.facebook.fresco', module: 'nativeimagetranscoder'
15
+ exclude group: 'com.facebook.fresco', module: 'memory-type-native'
16
+ exclude group: 'com.facebook.fresco', module: 'imagepipeline-native'
13
17
  }
14
18
  implementation("com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion") {
15
19
  exclude group: 'com.facebook.soloader', module: 'soloader'
16
20
  }
17
- implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
18
- exclude group: 'com.facebook.soloader', module: 'soloader'
19
- }
21
+ // implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
22
+ // exclude group: 'com.facebook.soloader', module: 'soloader'
23
+ // }
20
24
  implementation(name:'widgets-release', ext:'aar')
21
25
  }
@@ -24,8 +24,6 @@ import org.nativescript.widgets.BorderDrawable;
24
24
 
25
25
  import java.util.Arrays;
26
26
 
27
- import androidx.annotation.RequiresApi;
28
-
29
27
  public class DraweeView extends SimpleDraweeView {
30
28
  public int imageWidth = 0;
31
29
  public int imageHeight = 0;
@@ -108,7 +106,6 @@ public class DraweeView extends SimpleDraweeView {
108
106
  Path innerBorderPath;
109
107
  Path innerBorderTempPath;
110
108
 
111
- @RequiresApi(api = Build.VERSION_CODES.KITKAT)
112
109
  private Path generateInnerBorderPath(BorderDrawable borderDrawable) {
113
110
 
114
111
  float borderTopLeftRadius = borderDrawable.getBorderTopLeftRadius();
@@ -154,7 +151,6 @@ public class DraweeView extends SimpleDraweeView {
154
151
  return innerBorderPath;
155
152
  }
156
153
 
157
- @RequiresApi(api = Build.VERSION_CODES.KITKAT)
158
154
  @Override
159
155
  protected void onDraw(Canvas canvas) {
160
156
  Drawable drawable = getBackground();
@@ -1,5 +1,32 @@
1
1
  {
2
2
  "uses": [
3
- "com.facebook.drawee.drawable:ScalingUtils*","com.facebook.drawee.drawable.ScalingUtils:ScaleType*","com.facebook.drawee.generic:RoundingParams*","com.facebook.drawee.drawable:ProgressBarDrawable*","com.facebook.drawee.view:DraweeView*","com.facebook.drawee.interfaces:DraweeHierarchy*","com.facebook.drawee.interfaces:SettableDraweeHierarchy*","com.facebook.drawee.interfaces:SimpleDraweeControllerBuilder*","com.facebook.drawee.interfaces:DraweeController*","com.facebook.drawee.generic:GenericDraweeHierarchyBuilder*","com.facebook.drawee.generic:GenericDraweeHierarchy*","com.facebook.imagepipeline.request:ImageRequestBuilder*","com.facebook.imagepipeline.request:ImageRequest*","com.facebook.imagepipeline.core:ImagePipelineConfig*","com.facebook.imagepipeline.common:RotationOptions*","com.facebook.imagepipeline.common:ResizeOptions*","com.facebook.drawee.backends.pipeline:Fresco*","com.facebook.drawee.backends.pipeline:PipelineDraweeControllerBuilder*","com.facebook.drawee.backends.pipeline:PipelineDraweeController*","com.facebook.drawee.controller:AbstractDraweeControllerBuilder*","com.facebook.drawee.controller:AbstractDraweeController*","com.facebook.drawee.backends.pipeline.info:ImagePerfDataListener*","com.facebook.drawee.backends.pipeline.info:ImagePerfData*","com.facebook.drawee.controller:ControllerListener*","com.nativescript.image:DraweeView*","com.nativescript.image:ScalingBlurPostprocessor*","android.graphics.drawable:Animatable"
3
+ "com.facebook.drawee.drawable:ScalingUtils*",
4
+ "com.facebook.drawee.drawable.ScalingUtils:ScaleType*",
5
+ "com.facebook.drawee.generic:RoundingParams*",
6
+ "com.facebook.drawee.drawable:ProgressBarDrawable*",
7
+ "com.facebook.drawee.view:DraweeView*",
8
+ "com.facebook.drawee.interfaces:DraweeHierarchy*",
9
+ "com.facebook.drawee.interfaces:SettableDraweeHierarchy*",
10
+ "com.facebook.drawee.interfaces:SimpleDraweeControllerBuilder*",
11
+ "com.facebook.drawee.interfaces:DraweeController*",
12
+ "com.facebook.drawee.generic:GenericDraweeHierarchyBuilder*",
13
+ "com.facebook.drawee.generic:GenericDraweeHierarchy*",
14
+ "com.facebook.imagepipeline.request:ImageRequestBuilder*",
15
+ "com.facebook.imagepipeline.request:ImageRequest*",
16
+ "com.facebook.imagepipeline.core:ImagePipelineConfig*",
17
+ "com.facebook.imagepipeline.common:RotationOptions*",
18
+ "com.facebook.imagepipeline.common:ResizeOptions*",
19
+ "com.facebook.drawee.backends.pipeline:Fresco*",
20
+ "com.facebook.drawee.backends.pipeline:PipelineDraweeControllerBuilder*",
21
+ "com.facebook.drawee.backends.pipeline:PipelineDraweeController*",
22
+ "com.facebook.drawee.controller:AbstractDraweeControllerBuilder*",
23
+ "com.facebook.drawee.controller:AbstractDraweeController*",
24
+ "com.facebook.drawee.backends.pipeline.info:ImagePerfDataListener*",
25
+ "com.facebook.drawee.backends.pipeline.info:ImagePerfData*",
26
+ "com.facebook.drawee.controller:ControllerListener*",
27
+ "com.nativescript.image:DraweeView*",
28
+ "com.nativescript.image:ScalingBlurPostprocessor*",
29
+ "android.graphics.drawable:Animatable",
30
+ "com.facebook.imagepipeline.image:ImageInfo*"
4
31
  ]
5
32
  }
@@ -1,4 +0,0 @@
1
- declare const ImagePlugin: {
2
- install(client: any): void;
3
- };
4
- export default ImagePlugin;
package/flipper/index.js DELETED
@@ -1,9 +0,0 @@
1
- import { enableFlipper } from '../image';
2
- const ImagePlugin = {
3
- install(client) {
4
- enableFlipper();
5
- client.addPlugin(new com.facebook.flipper.plugins.fresco.FrescoFlipperPlugin());
6
- }
7
- };
8
- export default ImagePlugin;
9
- //# sourceMappingURL=index.js.map