@nativescript-community/ui-image 4.3.5 → 4.3.6

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,14 @@
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.6](https://github.com/nativescript-community/ui-image/compare/v4.3.5...v4.3.6) (2022-12-01)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-image
9
+
10
+
11
+
12
+
13
+
6
14
  ## [4.3.5](https://github.com/nativescript-community/ui-image/compare/v4.3.4...v4.3.5) (2022-09-29)
7
15
 
8
16
  **Note:** Version bump only for package @nativescript-community/ui-image
@@ -6,13 +6,13 @@
6
6
  "esm2020": "esm2020/nativescript-community-ui-image-angular.mjs",
7
7
  "fesm2020": "fesm2020/nativescript-community-ui-image-angular.mjs",
8
8
  "fesm2015": "fesm2015/nativescript-community-ui-image-angular.mjs",
9
- "typings": "nativescript-community-ui-image-angular.d.ts",
9
+ "typings": "index.d.ts",
10
10
  "exports": {
11
11
  "./package.json": {
12
12
  "default": "./package.json"
13
13
  },
14
14
  ".": {
15
- "types": "./nativescript-community-ui-image-angular.d.ts",
15
+ "types": "./index.d.ts",
16
16
  "esm2020": "./esm2020/nativescript-community-ui-image-angular.mjs",
17
17
  "es2020": "./fesm2020/nativescript-community-ui-image-angular.mjs",
18
18
  "es2015": "./fesm2015/nativescript-community-ui-image-angular.mjs",
package/index.android.js CHANGED
@@ -3,19 +3,19 @@ export * from './index-common';
3
3
  import { Color, Image, ImageAsset, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
4
4
  import { android as androidApp } from '@nativescript/core/application';
5
5
  import { isString } from '@nativescript/core/utils/types';
6
- import { RESOURCE_PREFIX, ad, isFileOrResourcePath, isFontIconURI } from '@nativescript/core/utils/utils';
7
6
  import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
7
+ import { layout } from '@nativescript/core/utils/layout-helper';
8
8
  let initialized = false;
9
9
  let initializeConfig;
10
10
  export function initialize(config) {
11
11
  if (!initialized) {
12
- const context = ad.getApplicationContext();
12
+ const context = Utils.ad.getApplicationContext();
13
13
  if (!context) {
14
14
  initializeConfig = config;
15
15
  return;
16
16
  }
17
17
  let builder;
18
- const useOkhttp = config === null || config === void 0 ? void 0 : config.useOkhttp;
18
+ const useOkhttp = config?.useOkhttp;
19
19
  if (useOkhttp) {
20
20
  if (useOkhttp instanceof okhttp3.OkHttpClient) {
21
21
  builder = com.facebook.imagepipeline.backends.okhttp3.OkHttpImagePipelineConfigFactory.newBuilder(context, useOkhttp);
@@ -27,10 +27,10 @@ export function initialize(config) {
27
27
  else {
28
28
  builder = com.facebook.imagepipeline.core.ImagePipelineConfig.newBuilder(context);
29
29
  }
30
- if (config === null || config === void 0 ? void 0 : config.isDownsampleEnabled) {
30
+ if (config?.isDownsampleEnabled) {
31
31
  builder.setDownsampleEnabled(true);
32
32
  }
33
- if (config === null || config === void 0 ? void 0 : config.leakTracker) {
33
+ if (config?.leakTracker) {
34
34
  builder.setCloseableReferenceLeakTracker(config.leakTracker);
35
35
  }
36
36
  const imagePipelineConfig = builder.build();
@@ -65,9 +65,9 @@ function getUri(src) {
65
65
  else {
66
66
  imagePath = src;
67
67
  }
68
- if (isFileOrResourcePath(imagePath)) {
69
- if (imagePath.indexOf(RESOURCE_PREFIX) === 0) {
70
- const resName = imagePath.substring(RESOURCE_PREFIX.length);
68
+ if (Utils.isFileOrResourcePath(imagePath)) {
69
+ if (imagePath.indexOf(Utils.RESOURCE_PREFIX) === 0) {
70
+ const resName = imagePath.substring(Utils.RESOURCE_PREFIX.length);
71
71
  const identifier = Utils.ad.resources.getDrawableId(resName);
72
72
  if (0 < identifier) {
73
73
  uri = new android.net.Uri.Builder().scheme(com.facebook.common.util.UriUtil.LOCAL_RESOURCE_SCHEME).path(java.lang.String.valueOf(identifier)).build();
@@ -329,9 +329,8 @@ export class Img extends ImageBase {
329
329
  this.updateHierarchy();
330
330
  }
331
331
  [ImageBase.imageRotationProperty.setNative](value) {
332
- var _u;
333
332
  const scaleType = this.nativeImageViewProtected.getHierarchy().getActualImageScaleType();
334
- (_u = scaleType['setImageRotation']) === null || _u === void 0 ? void 0 : _u.call(scaleType, value);
333
+ scaleType['setImageRotation']?.(value);
335
334
  this.nativeImageViewProtected.invalidate();
336
335
  }
337
336
  [_k = ImageBase.roundTopRightRadiusProperty.setNative]() {
@@ -371,15 +370,15 @@ export class Img extends ImageBase {
371
370
  if (src) {
372
371
  let drawable;
373
372
  if (src instanceof ImageSource) {
374
- drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), src.android);
373
+ drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), src.android);
375
374
  this.updateViewSize(src.android);
376
375
  }
377
- else if (isFontIconURI(src)) {
376
+ else if (Utils.isFontIconURI(src)) {
378
377
  const fontIconCode = src.split('//')[1];
379
378
  if (fontIconCode !== undefined) {
380
379
  const font = this.style.fontInternal;
381
380
  const color = this.style.color;
382
- drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
381
+ drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
383
382
  }
384
383
  }
385
384
  if (drawable) {
@@ -620,16 +619,16 @@ export class Img extends ImageBase {
620
619
  getDrawable(path) {
621
620
  let drawable;
622
621
  if (typeof path === 'string') {
623
- if (isFontIconURI(path)) {
622
+ if (Utils.isFontIconURI(path)) {
624
623
  const fontIconCode = path.split('//')[1];
625
624
  if (fontIconCode !== undefined) {
626
625
  const font = this.style.fontInternal;
627
626
  const color = this.style.color;
628
- drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
627
+ drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
629
628
  }
630
629
  }
631
- else if (isFileOrResourcePath(path)) {
632
- if (path.indexOf(RESOURCE_PREFIX) === 0) {
630
+ else if (Utils.isFileOrResourcePath(path)) {
631
+ if (path.indexOf(Utils.RESOURCE_PREFIX) === 0) {
633
632
  return this.getDrawableFromResource(path);
634
633
  }
635
634
  else {
@@ -638,7 +637,7 @@ export class Img extends ImageBase {
638
637
  }
639
638
  }
640
639
  else {
641
- drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), path.android);
640
+ drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), path.android);
642
641
  }
643
642
  return drawable;
644
643
  }
@@ -646,12 +645,12 @@ export class Img extends ImageBase {
646
645
  const img = ImageSource.fromFileSync(localFilePath);
647
646
  let drawable = null;
648
647
  if (img) {
649
- drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), img.android);
648
+ drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), img.android);
650
649
  }
651
650
  return drawable;
652
651
  }
653
652
  getDrawableFromResource(resourceName) {
654
- const identifier = ad.getApplication().getResources().getIdentifier(resourceName.substr(RESOURCE_PREFIX.length), 'drawable', ad.getApplication().getPackageName());
653
+ const identifier = Utils.ad.getApplication().getResources().getIdentifier(resourceName.substr(Utils.RESOURCE_PREFIX.length), 'drawable', Utils.ad.getApplication().getPackageName());
655
654
  return identifier;
656
655
  }
657
656
  startAnimating() {
@@ -733,7 +732,7 @@ __decorate([
733
732
  ], Img.prototype, _t, null);
734
733
  class GenericDraweeHierarchyBuilder {
735
734
  constructor() {
736
- const res = ad.getApplicationContext().getResources();
735
+ const res = Utils.ad.getApplicationContext().getResources();
737
736
  this.nativeBuilder = new com.facebook.drawee.generic.GenericDraweeHierarchyBuilder(res);
738
737
  }
739
738
  setPlaceholderImage(drawable, scaleType) {
package/index.ios.js CHANGED
@@ -1,8 +1,8 @@
1
1
  export * from './index-common';
2
- import { ImageAsset, ImageSource, Screen, Trace, knownFolders, path } from '@nativescript/core';
2
+ import { ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
3
3
  import { isString } from '@nativescript/core/utils/types';
4
- import { RESOURCE_PREFIX, isFileOrResourcePath, isFontIconURI, layout } from '@nativescript/core/utils/utils';
5
4
  import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
5
+ import { layout } from '@nativescript/core/utils/layout-helper';
6
6
  export class ImageInfo {
7
7
  constructor(width, height) {
8
8
  this.width = width;
@@ -135,8 +135,8 @@ function getUri(src) {
135
135
  if (src instanceof ImageAsset) {
136
136
  return NSURL.sd_URLWithAsset(src.ios);
137
137
  }
138
- if (uri.indexOf(RESOURCE_PREFIX) === 0) {
139
- const resName = uri.substr(RESOURCE_PREFIX.length);
138
+ if (uri.indexOf(Utils.RESOURCE_PREFIX) === 0) {
139
+ const resName = uri.substr(Utils.RESOURCE_PREFIX.length);
140
140
  if (screenScale === -1) {
141
141
  screenScale = Screen.mainScreen.scale;
142
142
  }
@@ -280,7 +280,7 @@ export class Img extends ImageBase {
280
280
  }
281
281
  let image;
282
282
  if (typeof imagePath === 'string') {
283
- if (isFontIconURI(imagePath)) {
283
+ if (Utils.isFontIconURI(imagePath)) {
284
284
  const fontIconCode = imagePath.split('//')[1];
285
285
  if (fontIconCode !== undefined) {
286
286
  const font = this.style.fontInternal;
@@ -288,7 +288,7 @@ export class Img extends ImageBase {
288
288
  image = ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios;
289
289
  }
290
290
  }
291
- if (!image && isFileOrResourcePath(imagePath)) {
291
+ if (!image && Utils.isFileOrResourcePath(imagePath)) {
292
292
  image = ImageSource.fromFileOrResourceSync(imagePath);
293
293
  }
294
294
  }
@@ -314,7 +314,7 @@ export class Img extends ImageBase {
314
314
  return;
315
315
  }
316
316
  else if (typeof src === 'string') {
317
- if (isFontIconURI(src)) {
317
+ if (Utils.isFontIconURI(src)) {
318
318
  const fontIconCode = src.split('//')[1];
319
319
  if (fontIconCode !== undefined) {
320
320
  const font = this.style.fontInternal;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.5",
3
+ "version": "4.3.6",
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": "8e01d92bb19439fe14e45f384a5238cfa4fc90e8"
47
+ "gitHead": "b15694e34058498f37ead9ddc5e2362cc1f2e18c"
48
48
  }
@@ -1,2 +0,0 @@
1
- /// <amd-module name="@nativescript-community/ui-image-angular" />
2
- export * from './index';