@nativescript-community/ui-image 4.3.27 → 4.3.29
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 +12 -0
- package/angular/esm2022/directives.mjs +3 -3
- package/angular/esm2022/module.mjs +2 -2
- package/angular/fesm2022/nativescript-community-ui-image-angular.mjs +3 -3
- package/index-common.d.ts +4 -4
- package/index-common.js +5 -7
- package/index.android.js +2 -2
- package/index.ios.js +7 -3
- package/package.json +2 -10
- package/platforms/android/java/com/nativescript/image/DraweeView.java +46 -24
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,18 @@
|
|
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.29](https://github.com/nativescript-community/ui-image/compare/v4.3.28...v4.3.29) (2024-02-02)
|
7
|
+
|
8
|
+
### Bug Fixes
|
9
|
+
|
10
|
+
* **ios:** npm release fix ([68a75fe](https://github.com/nativescript-community/ui-image/commit/68a75fe83488c83d897b0358b580563390d027a3))
|
11
|
+
|
12
|
+
## [4.3.28](https://github.com/nativescript-community/ui-image/compare/v4.3.27...v4.3.28) (2024-01-23)
|
13
|
+
|
14
|
+
### Bug Fixes
|
15
|
+
|
16
|
+
* **android:** improvement for future N ([f8e10f5](https://github.com/nativescript-community/ui-image/commit/f8e10f56945dbb76800d9fd90f2c6bd40966423f))
|
17
|
+
|
6
18
|
## [4.3.27](https://github.com/nativescript-community/ui-image/compare/v4.3.26...v4.3.27) (2023-11-24)
|
7
19
|
|
8
20
|
**Note:** Version bump only for package @nativescript-community/ui-image
|
@@ -5,11 +5,11 @@ export class ImgDirective {
|
|
5
5
|
static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
|
6
6
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
7
7
|
}
|
8
|
-
(
|
8
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
|
9
9
|
type: Directive,
|
10
10
|
args: [{
|
11
11
|
selector: 'NSImg'
|
12
12
|
}]
|
13
|
-
}],
|
13
|
+
}], () => [], null); })();
|
14
14
|
export const NSIMG_DIRECTIVES = [ImgDirective];
|
15
|
-
//# sourceMappingURL=data:application/json;base64,
|
15
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZGlyZWN0aXZlcy5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uL3NyYy9pbWFnZS9hbmd1bGFyL2RpcmVjdGl2ZXMudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUEsT0FBTyxFQUFFLFNBQVMsRUFBRSxNQUFNLGVBQWUsQ0FBQzs7QUFLMUMsTUFBTSxPQUFPLFlBQVk7SUFDckIsZ0JBQWUsQ0FBQztzRUFEUCxZQUFZOzZEQUFaLFlBQVk7O2lGQUFaLFlBQVk7Y0FIeEIsU0FBUztlQUFDO2dCQUNQLFFBQVEsRUFBRSxPQUFPO2FBQ3BCOztBQUlELE1BQU0sQ0FBQyxNQUFNLGdCQUFnQixHQUFHLENBQUMsWUFBWSxDQUFDLENBQUMiLCJzb3VyY2VzQ29udGVudCI6WyJpbXBvcnQgeyBEaXJlY3RpdmUgfSBmcm9tICdAYW5ndWxhci9jb3JlJztcblxuQERpcmVjdGl2ZSh7XG4gICAgc2VsZWN0b3I6ICdOU0ltZydcbn0pXG5leHBvcnQgY2xhc3MgSW1nRGlyZWN0aXZlIHtcbiAgICBjb25zdHJ1Y3RvcigpIHt9XG59XG5leHBvcnQgY29uc3QgTlNJTUdfRElSRUNUSVZFUyA9IFtJbWdEaXJlY3RpdmVdO1xuIl19
|
@@ -10,7 +10,7 @@ export class TNSImageModule {
|
|
10
10
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
11
11
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
12
12
|
}
|
13
|
-
(
|
13
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
|
14
14
|
type: NgModule,
|
15
15
|
args: [{
|
16
16
|
declarations: [NSIMG_DIRECTIVES],
|
@@ -19,4 +19,4 @@ export class TNSImageModule {
|
|
19
19
|
}], null, null); })();
|
20
20
|
(function () { (typeof ngJitMode === "undefined" || ngJitMode) && i0.ɵɵsetNgModuleScope(TNSImageModule, { declarations: [i1.ImgDirective], exports: [i1.ImgDirective] }); })();
|
21
21
|
registerElement('NSImg', () => Img);
|
22
|
-
//# sourceMappingURL=data:application/json;base64,
|
22
|
+
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibW9kdWxlLmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vc3JjL2ltYWdlL2FuZ3VsYXIvbW9kdWxlLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUNBLE9BQU8sRUFBRSxRQUFRLEVBQUUsTUFBTSxlQUFlLENBQUM7QUFDekMsT0FBTyxFQUFFLGVBQWUsRUFBRSxNQUFNLHVCQUF1QixDQUFDO0FBRXhELE9BQU8sRUFBRSxZQUFZLEVBQUUsZ0JBQWdCLEVBQUUsTUFBTSxjQUFjLENBQUM7QUFDOUQsT0FBTyxFQUFFLEdBQUcsRUFBRSxNQUFNLGtDQUFrQyxDQUFDOzs7QUFDdkQsT0FBTyxFQUFFLFlBQVksRUFBRSxDQUFDO0FBS3hCLE1BQU0sT0FBTyxjQUFjO3dFQUFkLGNBQWM7NERBQWQsY0FBYzs7O2lGQUFkLGNBQWM7Y0FKMUIsUUFBUTtlQUFDO2dCQUNOLFlBQVksRUFBRSxDQUFDLGdCQUFnQixDQUFDO2dCQUNoQyxPQUFPLEVBQUUsQ0FBQyxnQkFBZ0IsQ0FBQzthQUM5Qjs7d0ZBQ1ksY0FBYztBQUUzQixlQUFlLENBQUMsT0FBTyxFQUFFLEdBQUcsRUFBRSxDQUFDLEdBQUcsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiXG5pbXBvcnQgeyBOZ01vZHVsZSB9IGZyb20gJ0Bhbmd1bGFyL2NvcmUnO1xuaW1wb3J0IHsgcmVnaXN0ZXJFbGVtZW50IH0gZnJvbSAnQG5hdGl2ZXNjcmlwdC9hbmd1bGFyJztcblxuaW1wb3J0IHsgSW1nRGlyZWN0aXZlLCBOU0lNR19ESVJFQ1RJVkVTIH0gZnJvbSAnLi9kaXJlY3RpdmVzJztcbmltcG9ydCB7IEltZyB9IGZyb20gJ0BuYXRpdmVzY3JpcHQtY29tbXVuaXR5L3VpLWltYWdlJztcbmV4cG9ydCB7IEltZ0RpcmVjdGl2ZSB9O1xuQE5nTW9kdWxlKHtcbiAgICBkZWNsYXJhdGlvbnM6IFtOU0lNR19ESVJFQ1RJVkVTXSxcbiAgICBleHBvcnRzOiBbTlNJTUdfRElSRUNUSVZFU10sXG59KVxuZXhwb3J0IGNsYXNzIFROU0ltYWdlTW9kdWxlIHt9XG5cbnJlZ2lzdGVyRWxlbWVudCgnTlNJbWcnLCAoKSA9PiBJbWcpO1xuIl19
|
@@ -8,12 +8,12 @@ class ImgDirective {
|
|
8
8
|
static ɵfac = function ImgDirective_Factory(t) { return new (t || ImgDirective)(); };
|
9
9
|
static ɵdir = /*@__PURE__*/ i0.ɵɵdefineDirective({ type: ImgDirective, selectors: [["NSImg"]] });
|
10
10
|
}
|
11
|
-
(
|
11
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(ImgDirective, [{
|
12
12
|
type: Directive,
|
13
13
|
args: [{
|
14
14
|
selector: 'NSImg'
|
15
15
|
}]
|
16
|
-
}],
|
16
|
+
}], () => [], null); })();
|
17
17
|
const NSIMG_DIRECTIVES = [ImgDirective];
|
18
18
|
|
19
19
|
class TNSImageModule {
|
@@ -21,7 +21,7 @@ class TNSImageModule {
|
|
21
21
|
static ɵmod = /*@__PURE__*/ i0.ɵɵdefineNgModule({ type: TNSImageModule });
|
22
22
|
static ɵinj = /*@__PURE__*/ i0.ɵɵdefineInjector({});
|
23
23
|
}
|
24
|
-
(
|
24
|
+
(() => { (typeof ngDevMode === "undefined" || ngDevMode) && i0.ɵsetClassMetadata(TNSImageModule, [{
|
25
25
|
type: NgModule,
|
26
26
|
args: [{
|
27
27
|
declarations: [NSIMG_DIRECTIVES],
|
package/index-common.d.ts
CHANGED
@@ -3,10 +3,10 @@ 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
5
|
export declare enum CLogTypes {
|
6
|
-
log,
|
7
|
-
info,
|
8
|
-
warning,
|
9
|
-
error
|
6
|
+
log = 0,
|
7
|
+
info = 1,
|
8
|
+
warning = 2,
|
9
|
+
error = 3
|
10
10
|
}
|
11
11
|
export declare const ImageViewTraceCategory = "NativescriptImage";
|
12
12
|
export declare const CLog: (type: CLogTypes, ...args: any[]) => void;
|
package/index-common.js
CHANGED
@@ -1,6 +1,4 @@
|
|
1
|
-
import {
|
2
|
-
import { ImageAsset } from '@nativescript/core/image-asset';
|
3
|
-
import { ImageSource } from '@nativescript/core/image-source';
|
1
|
+
import { Length, Property, Trace, View, booleanConverter } from '@nativescript/core';
|
4
2
|
import { isAndroid } from '@nativescript/core/platform';
|
5
3
|
function isNonNegativeFiniteNumber(value) {
|
6
4
|
return isFinite(value) && !isNaN(value) && value >= 0;
|
@@ -52,10 +50,10 @@ function parseThickness(value) {
|
|
52
50
|
}
|
53
51
|
export var CLogTypes;
|
54
52
|
(function (CLogTypes) {
|
55
|
-
CLogTypes[CLogTypes["log"] =
|
56
|
-
CLogTypes[CLogTypes["info"] =
|
57
|
-
CLogTypes[CLogTypes["warning"] =
|
58
|
-
CLogTypes[CLogTypes["error"] =
|
53
|
+
CLogTypes[CLogTypes["log"] = 0] = "log";
|
54
|
+
CLogTypes[CLogTypes["info"] = 1] = "info";
|
55
|
+
CLogTypes[CLogTypes["warning"] = 2] = "warning";
|
56
|
+
CLogTypes[CLogTypes["error"] = 3] = "error";
|
59
57
|
})(CLogTypes || (CLogTypes = {}));
|
60
58
|
export const ImageViewTraceCategory = 'NativescriptImage';
|
61
59
|
export const CLog = (type, ...args) => {
|
package/index.android.js
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u;
|
2
2
|
export * from './index-common';
|
3
|
-
import { Application,
|
3
|
+
import { Application, ImageAsset, ImageSource, Trace, Utils, backgroundInternalProperty, knownFolders, path } from '@nativescript/core';
|
4
4
|
import { isString } from '@nativescript/core/utils/types';
|
5
5
|
import { layout } from '@nativescript/core/utils/layout-helper';
|
6
6
|
import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, needRequestImage, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
|
@@ -682,7 +682,7 @@ export class Img extends ImageBase {
|
|
682
682
|
const bottomRightRadius = this.roundBottomRightRadius || 0;
|
683
683
|
const bottomLeftRadius = this.roundBottomLeftRadius || 0;
|
684
684
|
if (topLeftRadius || topRightRadius || bottomRightRadius || bottomLeftRadius) {
|
685
|
-
builder.setCornersRadii(topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
|
685
|
+
builder.setCornersRadii(Utils.layout.toDevicePixels(topLeftRadius), Utils.layout.toDevicePixels(topRightRadius), Utils.layout.toDevicePixels(bottomRightRadius), Utils.layout.toDevicePixels(bottomLeftRadius));
|
686
686
|
}
|
687
687
|
this.nativeImageViewProtected.setHierarchy(builder.build());
|
688
688
|
if (!this.mNeedRequestImage) {
|
package/index.ios.js
CHANGED
@@ -3,7 +3,7 @@ export * from './index-common';
|
|
3
3
|
import { 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,
|
6
|
+
import { CLog, CLogTypes, ImageBase, ScaleType, failureImageUriProperty, imageRotationProperty, placeholderImageUriProperty, srcProperty, stretchProperty } from './index-common';
|
7
7
|
export class ImageInfo {
|
8
8
|
constructor(width, height) {
|
9
9
|
this.width = width;
|
@@ -379,6 +379,10 @@ export class Img extends ImageBase {
|
|
379
379
|
const uri = getUri(src);
|
380
380
|
this.isLoading = true;
|
381
381
|
let options = 2048 /* SDWebImageOptions.ScaleDownLargeImages */ | 1024 /* SDWebImageOptions.AvoidAutoSetImage */;
|
382
|
+
if (this.placeholderImageUri) {
|
383
|
+
this.placeholderImage = this.getUIImage(this.placeholderImageUri);
|
384
|
+
this._setNativeImage(this.placeholderImage, animate);
|
385
|
+
}
|
382
386
|
if (this.noCache) {
|
383
387
|
// const key = uri.absoluteString;
|
384
388
|
// const imagePipeLine = getImagePipeline();
|
@@ -446,8 +450,8 @@ export class Img extends ImageBase {
|
|
446
450
|
this.initImage();
|
447
451
|
}
|
448
452
|
[_c = placeholderImageUriProperty.setNative]() {
|
449
|
-
this.placeholderImage = this.getUIImage(this.placeholderImageUri);
|
450
|
-
this.initImage();
|
453
|
+
// this.placeholderImage = this.getUIImage(this.placeholderImageUri);
|
454
|
+
// this.initImage();
|
451
455
|
}
|
452
456
|
[failureImageUriProperty.setNative]() {
|
453
457
|
// this.updateHierarchy();
|
package/package.json
CHANGED
@@ -1,18 +1,10 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-image",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.29",
|
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,
|
7
7
|
"typings": "./index.d.ts",
|
8
|
-
"scripts": {
|
9
|
-
"build": "npm run tsc && npm run readme",
|
10
|
-
"build.all": "npm run build && npm run build.angular",
|
11
|
-
"build.angular": "ng-packagr -p ../../src/image/angular/ng-package.json -c ../../src/image/angular/tsconfig.json",
|
12
|
-
"readme": "readme generate -c ../../tools/readme/blueprint.json",
|
13
|
-
"tsc": "cpy '**/*.d.ts' '../../packages/image' --parents --cwd=../../src/image && tsc -skipLibCheck -d",
|
14
|
-
"clean": "rimraf ./*.d.ts ./*.js ./*.js.map"
|
15
|
-
},
|
16
8
|
"nativescript": {
|
17
9
|
"platforms": {
|
18
10
|
"android": "6.0.0",
|
@@ -44,5 +36,5 @@
|
|
44
36
|
},
|
45
37
|
"license": "Apache-2.0",
|
46
38
|
"readmeFilename": "README.md",
|
47
|
-
"gitHead": "
|
39
|
+
"gitHead": "0940ba815f6f11c1b94f13050689e4e1d472855a"
|
48
40
|
}
|
@@ -123,34 +123,40 @@ public class DraweeView extends SimpleDraweeView {
|
|
123
123
|
mLegacyVisibilityHandlingEnabled = legacyVisibilityHandlingEnabled;
|
124
124
|
}
|
125
125
|
|
126
|
-
|
127
|
-
public void updateOutlineProvider() {
|
126
|
+
public void updateOutlineProvider() {
|
128
127
|
Drawable drawable = getBackground();
|
129
|
-
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
128
|
+
if (android.os.Build.VERSION.SDK_INT >= 21) {
|
129
|
+
// we try to support N setting outline provider now
|
130
|
+
if (!isUsingOutlineProvider && getOutlineProvider() != null) {
|
131
|
+
// already handled somewhere else
|
132
|
+
return;
|
133
|
+
}
|
134
|
+
if (drawable instanceof BorderDrawable && (android.os.Build.VERSION.SDK_INT >= 33 || ((BorderDrawable)drawable).hasUniformBorderRadius())) {
|
135
|
+
setOutlineProvider(new ViewOutlineProvider() {
|
136
|
+
@Override
|
137
|
+
public void getOutline(View view, Outline outline) {
|
138
|
+
Drawable drawable = getBackground();
|
139
|
+
if (drawable instanceof BorderDrawable) {
|
140
|
+
BorderDrawable borderDrawable = (BorderDrawable) drawable;
|
141
|
+
// that if test is only needed until N BorderDrawable is updated to do it
|
142
|
+
if (borderDrawable.hasUniformBorderRadius()) {
|
143
|
+
// outlineRect.set(borderDrawable.getBounds());
|
144
|
+
outline.setRoundRect(borderDrawable.getBounds(), borderDrawable.getBorderBottomLeftRadius());
|
145
|
+
} else {
|
146
|
+
drawable.getOutline(outline);
|
147
|
+
}
|
141
148
|
} else {
|
142
|
-
|
149
|
+
outline.setRect(100, 100, view.getWidth() - 200, view.getHeight() - 200);
|
143
150
|
}
|
144
|
-
} else {
|
145
|
-
outline.setRect(100, 100, view.getWidth() - 200, view.getHeight() - 200);
|
146
151
|
}
|
147
|
-
}
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
setOutlineProvider(null);
|
153
|
-
setClipToOutline(false);
|
152
|
+
});
|
153
|
+
setClipToOutline(true);
|
154
|
+
isUsingOutlineProvider = true;
|
155
|
+
// } else if (android.os.Build.VERSION.SDK_INT >= 21) {
|
156
|
+
// isUsingOutlineProvider = false;
|
157
|
+
// setOutlineProvider(null);
|
158
|
+
// setClipToOutline(false);
|
159
|
+
}
|
154
160
|
}
|
155
161
|
}
|
156
162
|
|
@@ -293,6 +299,22 @@ public class DraweeView extends SimpleDraweeView {
|
|
293
299
|
}
|
294
300
|
|
295
301
|
ImageRequest request = requestBuilder.build();
|
302
|
+
|
303
|
+
// if (object != null && object.optBoolean("async") == false) {
|
304
|
+
// DataSource<CloseableReference<CloseableImage>> dataSource =
|
305
|
+
// imagePipeline.fetchImageFromBitmapCache(imageRequest, uri.toString());
|
306
|
+
// try {
|
307
|
+
// CloseableReference<CloseableImage> result = DataSources.waitForFinalResult(dataSource);
|
308
|
+
// if (result != null) {
|
309
|
+
// // Do something with the image, but do not keep the reference to it!
|
310
|
+
// // The image may get recycled as soon as the reference gets closed below.
|
311
|
+
// // If you need to keep a reference to the image, read the following sections.
|
312
|
+
// }
|
313
|
+
// } finally {
|
314
|
+
// dataSource.close();
|
315
|
+
// }
|
316
|
+
// }
|
317
|
+
|
296
318
|
PipelineDraweeControllerBuilder builder = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder();
|
297
319
|
builder.setImageRequest(request);
|
298
320
|
builder.setCallerContext(uri.toString());
|