Skip to content

Commit 096d468

Browse files
committed
chore: N 8.4 update
1 parent cc5bb40 commit 096d468

File tree

8 files changed

+41
-30
lines changed

8 files changed

+41
-30
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,12 @@ yarn-error.log*
2121
.LSOverride
2222
.idea
2323
.cloud
24+
.gradle
2425
.project
26+
.yarn
2527
tmp/
2628
package-lock.json
29+
yarn.lock
2730

2831
!.eslintrc.js
2932
!.prettierrc.js

.npmrc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
shamefully-hoist=true
22
strict-peer-dependencies=false
3-
loglevel=error
3+
loglevel=error
4+
engine-strict=true

demo-ng

package.json

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"build.all": "lerna run build.all",
1717
"build.angular": "lerna run build.angular",
1818
"build.win": "lerna run build-win",
19-
"clean": "rimraf 'packages/**/*.d.ts' 'packages/**/*.js' 'packages/**/*.js.map' 'packages/**/*.metadata.json' 'packages/**/*.ngsummary.json' 'packages/**/*.mjs' 'packages/**/*.mjs.map' 'packages/**/node_modules' 'packages/**/angular/package.json' 'package-lock.json' 'pnpm-lock.yaml' 'node_modules'",
19+
"clean": "rimraf 'packages/**/*.d.ts' 'packages/**/*.js' 'packages/**/*.js.map' 'packages/**/*.metada 'packages/**/angular/ng-package.json'",
2020
"commitmsg": "commitlint -e $GIT_PARAMS",
2121
"demo.ng.android": "cd ./demo-ng && ns run android --no-hmr",
2222
"demo.ng.clean": "cd ./demo-ng && ns clean",
@@ -26,7 +26,7 @@
2626
"demo.vue.ios": "cd ./demo-vue && ns run ios --no-hmr",
2727
"postinstall": "npm run setup",
2828
"prepare": "npm run setup",
29-
"publish": "npm run setup && npm run build.all && lerna publish --create-release=github --force-publish",
29+
"publish": "npm run clean && npm run build.all && lerna publish --create-release=github --force-publish",
3030
"readme": "node ./tools/readme.js",
3131
"setup": "npm run submodules && ts-patch install",
3232
"start": "./node_modules/.bin/ntl -A -s 15 -o",
@@ -35,7 +35,9 @@
3535
"sync.test": "node ./tools/sync.js",
3636
"tsc": "cpy '**/*.d.ts' '../plugin' --parents --cwd=src && tsc -skipLibCheck -d",
3737
"update": "node ./tools/update.js",
38-
"watch": "npm run tsc -- -w"
38+
"watch": "npm run tsc -- -w",
39+
"fullclean": "npm run clean && rimraf 'packages/**/node_modules' 'package-lock.json' 'pnpm-lock.yaml' 'node_modules'",
40+
"doc": "node tools/builddoc.mjs && git add docs/* && git commit -m \"chore:doc\""
3941
},
4042
"commitlint": {
4143
"extends": [
@@ -57,5 +59,10 @@
5759
"demo.vue.ios": "Runs the Vue demo on iOS.",
5860
"watch": "Watch for changes in the plugin source and re-build."
5961
}
62+
},
63+
"engines": {
64+
"npm": "please use yarn or pnpm",
65+
"yarn": ">= 1.19.1",
66+
"pnpm": ">= 7.0.0"
6067
}
6168
}

src/image/index.android.ts

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ export * from './index-common';
22
import { Color, Image, ImageAsset, ImageSource, Trace, Utils, knownFolders, path } from '@nativescript/core';
33
import { android as androidApp } from '@nativescript/core/application';
44
import { isString } from '@nativescript/core/utils/types';
5-
import { RESOURCE_PREFIX, ad, isFileOrResourcePath, isFontIconURI } from '@nativescript/core/utils/utils';
65
import { AnimatedImage, CLog, CLogTypes, EventData, ImageBase, ImageError as ImageErrorBase, ImageInfo as ImageInfoBase, ImagePipelineConfigSetting, ScaleType } from './index-common';
6+
import { layout } from '@nativescript/core/utils/layout-helper';
77

88
let initialized = false;
99
let initializeConfig: ImagePipelineConfigSetting;
1010
export function initialize(config?: ImagePipelineConfigSetting): void {
1111
if (!initialized) {
12-
const context = ad.getApplicationContext();
12+
const context = Utils.ad.getApplicationContext();
1313
if (!context) {
1414
initializeConfig = config;
1515
return;
@@ -70,9 +70,9 @@ function getUri(src: string | ImageAsset) {
7070
} else {
7171
imagePath = src;
7272
}
73-
if (isFileOrResourcePath(imagePath)) {
74-
if (imagePath.indexOf(RESOURCE_PREFIX) === 0) {
75-
const resName = imagePath.substring(RESOURCE_PREFIX.length);
73+
if (Utils.isFileOrResourcePath(imagePath)) {
74+
if (imagePath.indexOf(Utils.RESOURCE_PREFIX) === 0) {
75+
const resName = imagePath.substring(Utils.RESOURCE_PREFIX.length);
7676
const identifier = Utils.ad.resources.getDrawableId(resName);
7777
if (0 < identifier) {
7878
uri = new android.net.Uri.Builder().scheme(com.facebook.common.util.UriUtil.LOCAL_RESOURCE_SCHEME).path(java.lang.String.valueOf(identifier)).build();
@@ -536,15 +536,15 @@ export class Img extends ImageBase {
536536
if (src) {
537537
let drawable: android.graphics.drawable.BitmapDrawable;
538538
if (src instanceof ImageSource) {
539-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), src.android as android.graphics.Bitmap);
539+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), src.android as android.graphics.Bitmap);
540540
this.updateViewSize(src.android);
541-
} else if (isFontIconURI(src as string)) {
541+
} else if (Utils.isFontIconURI(src as string)) {
542542
const fontIconCode = (src as string).split('//')[1];
543543
if (fontIconCode !== undefined) {
544544
// support sync mode only
545545
const font = this.style.fontInternal;
546546
const color = this.style.color;
547-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
547+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
548548
}
549549
}
550550
if (drawable) {
@@ -821,23 +821,23 @@ export class Img extends ImageBase {
821821
private getDrawable(path: string | ImageSource) {
822822
let drawable: android.graphics.drawable.BitmapDrawable;
823823
if (typeof path === 'string') {
824-
if (isFontIconURI(path)) {
824+
if (Utils.isFontIconURI(path)) {
825825
const fontIconCode = path.split('//')[1];
826826
if (fontIconCode !== undefined) {
827827
// support sync mode only
828828
const font = this.style.fontInternal;
829829
const color = this.style.color;
830-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
830+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), ImageSource.fromFontIconCodeSync(fontIconCode, font, color).android);
831831
}
832-
} else if (isFileOrResourcePath(path)) {
833-
if (path.indexOf(RESOURCE_PREFIX) === 0) {
832+
} else if (Utils.isFileOrResourcePath(path)) {
833+
if (path.indexOf(Utils.RESOURCE_PREFIX) === 0) {
834834
return this.getDrawableFromResource(path); // number!
835835
} else {
836836
drawable = this.getDrawableFromLocalFile(path);
837837
}
838838
}
839839
} else {
840-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), path.android);
840+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), path.android);
841841
}
842842

843843
return drawable;
@@ -847,14 +847,14 @@ export class Img extends ImageBase {
847847
const img = ImageSource.fromFileSync(localFilePath);
848848
let drawable: android.graphics.drawable.BitmapDrawable = null;
849849
if (img) {
850-
drawable = new android.graphics.drawable.BitmapDrawable(ad.getApplicationContext().getResources(), img.android);
850+
drawable = new android.graphics.drawable.BitmapDrawable(Utils.ad.getApplicationContext().getResources(), img.android);
851851
}
852852

853853
return drawable;
854854
}
855855

856856
private getDrawableFromResource(resourceName: string) {
857-
const identifier = ad.getApplication().getResources().getIdentifier(resourceName.substr(RESOURCE_PREFIX.length), 'drawable', ad.getApplication().getPackageName());
857+
const identifier = Utils.ad.getApplication().getResources().getIdentifier(resourceName.substr(Utils.RESOURCE_PREFIX.length), 'drawable', Utils.ad.getApplication().getPackageName());
858858
// we return the identifier to allow Fresco to handle memory / caching
859859
return identifier;
860860
}
@@ -887,7 +887,7 @@ class GenericDraweeHierarchyBuilder {
887887
private nativeBuilder: com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
888888

889889
constructor() {
890-
const res = ad.getApplicationContext().getResources();
890+
const res = Utils.ad.getApplicationContext().getResources();
891891
this.nativeBuilder = new com.facebook.drawee.generic.GenericDraweeHierarchyBuilder(res);
892892
}
893893

src/image/index.ios.ts

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
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';
33
import { isString } from '@nativescript/core/utils/types';
4-
import { RESOURCE_PREFIX, isFileOrResourcePath, isFontIconURI, layout } from '@nativescript/core/utils/utils';
54
import { CLog, CLogTypes, EventData, ImageBase, ImageInfo as ImageInfoBase, ImagePipelineConfigSetting, ScaleType, Stretch } from './index-common';
5+
import { layout } from '@nativescript/core/utils/layout-helper';
66

77
export class ImageInfo implements ImageInfoBase {
88
constructor(private width: number, private height: number) {}
@@ -160,8 +160,8 @@ function getUri(src: string | ImageAsset) {
160160
if (src instanceof ImageAsset) {
161161
return NSURL.sd_URLWithAsset(src.ios);
162162
}
163-
if (uri.indexOf(RESOURCE_PREFIX) === 0) {
164-
const resName = uri.substr(RESOURCE_PREFIX.length);
163+
if (uri.indexOf(Utils.RESOURCE_PREFIX) === 0) {
164+
const resName = uri.substr(Utils.RESOURCE_PREFIX.length);
165165
if (screenScale === -1) {
166166
screenScale = Screen.mainScreen.scale;
167167
}
@@ -335,7 +335,7 @@ export class Img extends ImageBase {
335335
}
336336
let image;
337337
if (typeof imagePath === 'string') {
338-
if (isFontIconURI(imagePath)) {
338+
if (Utils.isFontIconURI(imagePath)) {
339339
const fontIconCode = imagePath.split('//')[1];
340340
if (fontIconCode !== undefined) {
341341
// support sync mode only
@@ -344,7 +344,7 @@ export class Img extends ImageBase {
344344
image = ImageSource.fromFontIconCodeSync(fontIconCode, font, color).ios;
345345
}
346346
}
347-
if (!image && isFileOrResourcePath(imagePath)) {
347+
if (!image && Utils.isFileOrResourcePath(imagePath)) {
348348
image = ImageSource.fromFileOrResourceSync(imagePath);
349349
}
350350
} else {
@@ -371,7 +371,7 @@ export class Img extends ImageBase {
371371
this._setNativeImage(src.ios, animate);
372372
return;
373373
} else if (typeof src === 'string') {
374-
if (isFontIconURI(src)) {
374+
if (Utils.isFontIconURI(src)) {
375375
const fontIconCode = src.split('//')[1];
376376
if (fontIconCode !== undefined) {
377377
// support sync mode only

0 commit comments

Comments
 (0)