@nativescript-community/ui-image 4.3.41 → 4.4.0

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,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.4.0](https://github.com/nativescript-community/ui-image/compare/v4.3.41...v4.4.0) (2024-04-23)
7
+
8
+ ### Features
9
+
10
+ * **image:** add progress indicator for ios ([11b894a](https://github.com/nativescript-community/ui-image/commit/11b894a787afae629ba53038bbbcad4e1a48fc54))
11
+
6
12
  ## [4.3.41](https://github.com/nativescript-community/ui-image/compare/v4.3.40...v4.3.41) (2024-04-23)
7
13
 
8
14
  ### Bug Fixes
package/README.md CHANGED
@@ -448,7 +448,7 @@ Boolean value used for enabling or disabling the streaming of progressive JPEG i
448
448
  <@nativescript-community/ui-image:Img progressiveRenderingEnabled="true"/>
449
449
  ```
450
450
 
451
- - **showProgressBar** (Android only)
451
+ - **showProgressBar**
452
452
 
453
453
  Boolean value used for showing or hiding the progress bar.
454
454
 
@@ -456,7 +456,7 @@ Boolean value used for showing or hiding the progress bar.
456
456
  <@nativescript-community/ui-image:Img showProgressBar="true"/>
457
457
  ```
458
458
 
459
- - **progressBarColor** (Android only)
459
+ - **progressBarColor**
460
460
 
461
461
  String value used for setting the color of the progress bar. You can set it to hex values ("*#FF0000*") and/or predefined colors ("*green*").
462
462
 
package/blueprint.md CHANGED
@@ -381,7 +381,7 @@ Boolean value used for enabling or disabling the streaming of progressive JPEG i
381
381
  <@nativescript-community/ui-image:Img progressiveRenderingEnabled="true"/>
382
382
  ```
383
383
 
384
- - **showProgressBar** (Android only)
384
+ - **showProgressBar**
385
385
 
386
386
  Boolean value used for showing or hiding the progress bar.
387
387
 
@@ -389,7 +389,7 @@ Boolean value used for showing or hiding the progress bar.
389
389
  <@nativescript-community/ui-image:Img showProgressBar="true"/>
390
390
  ```
391
391
 
392
- - **progressBarColor** (Android only)
392
+ - **progressBarColor**
393
393
 
394
394
  String value used for setting the color of the progress bar. You can set it to hex values ("*#FF0000*") and/or predefined colors ("*green*").
395
395
 
package/index-common.d.ts CHANGED
@@ -2,6 +2,7 @@ import { Color, CoreTypes, Property, View } from '@nativescript/core';
2
2
  import { EventData as IEventData } from '@nativescript/core/data/observable';
3
3
  import { ImageAsset } from '@nativescript/core/image-asset';
4
4
  import { ImageSource } from '@nativescript/core/image-source';
5
+ export declare function colorConverter(v: string | Color): Color;
5
6
  export declare enum CLogTypes {
6
7
  log = 0,
7
8
  info = 1,
@@ -63,7 +64,7 @@ export declare const backgroundUriProperty: Property<ImageBase, string>;
63
64
  export declare const progressiveRenderingEnabledProperty: Property<ImageBase, boolean>;
64
65
  export declare const localThumbnailPreviewsEnabledProperty: Property<ImageBase, boolean>;
65
66
  export declare const showProgressBarProperty: Property<ImageBase, boolean>;
66
- export declare const progressBarColorProperty: Property<ImageBase, string>;
67
+ export declare const progressBarColorProperty: Property<ImageBase, Color>;
67
68
  export declare const roundAsCircleProperty: Property<ImageBase, boolean>;
68
69
  export declare const blurRadiusProperty: Property<ImageBase, number>;
69
70
  export declare const blurDownSamplingProperty: Property<ImageBase, number>;
package/index-common.js CHANGED
@@ -1,5 +1,11 @@
1
- import { Length, Property, Trace, View, booleanConverter } from '@nativescript/core';
1
+ import { Color, Length, Property, Trace, View, booleanConverter } from '@nativescript/core';
2
2
  import { isAndroid } from '@nativescript/core/platform';
3
+ export function colorConverter(v) {
4
+ if (!v || v instanceof Color) {
5
+ return v;
6
+ }
7
+ return new Color(v);
8
+ }
3
9
  function isNonNegativeFiniteNumber(value) {
4
10
  return isFinite(value) && !isNaN(value) && value >= 0;
5
11
  }
@@ -119,8 +125,8 @@ export const stretchProperty = new Property({ name: 'stretch' });
119
125
  export const backgroundUriProperty = new Property({ name: 'backgroundUri' });
120
126
  export const progressiveRenderingEnabledProperty = new Property({ name: 'progressiveRenderingEnabled', valueConverter: booleanConverter });
121
127
  export const localThumbnailPreviewsEnabledProperty = new Property({ name: 'localThumbnailPreviewsEnabled', valueConverter: booleanConverter });
122
- export const showProgressBarProperty = new Property({ name: 'showProgressBar', valueConverter: booleanConverter });
123
- export const progressBarColorProperty = new Property({ name: 'progressBarColor', defaultValue: undefined });
128
+ export const showProgressBarProperty = new Property({ name: 'showProgressBar', valueConverter: booleanConverter, defaultValue: false });
129
+ export const progressBarColorProperty = new Property({ name: 'progressBarColor', valueConverter: colorConverter });
124
130
  export const roundAsCircleProperty = new Property({ name: 'roundAsCircle', valueConverter: booleanConverter, affectsLayout: isAndroid });
125
131
  export const blurRadiusProperty = new Property({ name: 'blurRadius', valueConverter: (v) => parseFloat(v) });
126
132
  export const blurDownSamplingProperty = new Property({ name: 'blurDownSampling', valueConverter: (v) => parseFloat(v) });
package/index.ios.js CHANGED
@@ -1,9 +1,9 @@
1
- var _a, _b, _c;
1
+ var _a, _b, _c, _d;
2
2
  export * from './index-common';
3
- import { ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
3
+ import { Color, ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
4
4
  import { layout } from '@nativescript/core/utils/layout-helper';
5
5
  import { isString } from '@nativescript/core/utils/types';
6
- import { CLog, CLogTypes, ImageBase, ScaleType, failureImageUriProperty, imageRotationProperty, placeholderImageUriProperty, srcProperty, stretchProperty, wrapNativeException } from './index-common';
6
+ import { CLog, CLogTypes, ImageBase, ScaleType, failureImageUriProperty, imageRotationProperty, placeholderImageUriProperty, progressBarColorProperty, showProgressBarProperty, srcProperty, stretchProperty, wrapNativeException } from './index-common';
7
7
  export class ImageInfo {
8
8
  constructor(width, height) {
9
9
  this.width = width;
@@ -457,6 +457,21 @@ export class Img extends ImageBase {
457
457
  });
458
458
  }
459
459
  this.mCacheKey = SDWebImageManager.sharedManager.cacheKeyForURLContext(uri, context);
460
+ if (this.showProgressBar) {
461
+ try {
462
+ if (this.progressBarColor && Color.isValid(this.progressBarColor)) {
463
+ const indicator = new SDWebImageActivityIndicator();
464
+ indicator.indicatorView.color = new Color(this.progressBarColor).ios;
465
+ this.nativeImageViewProtected.sd_imageIndicator = indicator;
466
+ }
467
+ else {
468
+ this.nativeImageViewProtected.sd_imageIndicator = SDWebImageActivityIndicator.grayIndicator;
469
+ }
470
+ }
471
+ catch (ex) {
472
+ console.error(ex);
473
+ }
474
+ }
460
475
  this.nativeImageViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(uri, this.placeholderImage, options, context, this.onLoadProgress, this.handleImageLoaded);
461
476
  }
462
477
  else if (this.placeholderImage) {
@@ -473,9 +488,12 @@ export class Img extends ImageBase {
473
488
  [_b = imageRotationProperty.setNative](value) {
474
489
  this.initImage();
475
490
  }
476
- [_c = placeholderImageUriProperty.setNative]() {
477
- // this.placeholderImage = this.getUIImage(this.placeholderImageUri);
478
- // this.initImage();
491
+ [_c = placeholderImageUriProperty.setNative]() { }
492
+ [_d = showProgressBarProperty.setNative](value) {
493
+ this.showProgressBar = value;
494
+ }
495
+ [progressBarColorProperty.setNative](value) {
496
+ this.progressBarColor = value;
479
497
  }
480
498
  [failureImageUriProperty.setNative]() {
481
499
  // this.updateHierarchy();
@@ -515,4 +533,7 @@ __decorate([
515
533
  __decorate([
516
534
  needRequestImage
517
535
  ], Img.prototype, _c, null);
536
+ __decorate([
537
+ needRequestImage
538
+ ], Img.prototype, _d, null);
518
539
  //# sourceMappingURL=index.ios.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.41",
3
+ "version": "4.4.0",
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,
@@ -36,5 +36,5 @@
36
36
  },
37
37
  "license": "Apache-2.0",
38
38
  "readmeFilename": "README.md",
39
- "gitHead": "74b1253fcbfcebe4dd5458ee9e0962294482c426"
39
+ "gitHead": "532c0a394b6a40a8168483f729d831707b8d50c4"
40
40
  }
package/typings/ios.d.ts CHANGED
@@ -6,6 +6,8 @@ declare namespace NSURL {
6
6
  export function sd_URLWithAssetLocalIdentifier(identifier: string): NSURL;
7
7
  }
8
8
  declare interface UIImageView {
9
+ sd_imageIndicator: SDWebImageIndicator;
10
+
9
11
  sd_setHighlightedImageWithURL(url: NSURL): void;
10
12
 
11
13
  sd_setHighlightedImageWithURLCompleted(url: NSURL, completedBlock: (p1: UIImage, p2: NSError, p3: SDImageCacheType, p4: NSURL) => void): void;