Pre Merge pull request !442 from zgf/master
This commit is contained in:
commit
d7d9e371ba
|
@ -1,3 +1,7 @@
|
||||||
|
## 3.2.0-rc.6
|
||||||
|
- LogUtil adds switch
|
||||||
|
- ImageKnifeOption adds network request timeout parameter
|
||||||
|
|
||||||
## 3.2.0-rc.5
|
## 3.2.0-rc.5
|
||||||
- Enhance: ImageFit.Auto support adaptive height after component width change
|
- Enhance: ImageFit.Auto support adaptive height after component width change
|
||||||
- Fix bug: call onLoadStart 2 times(import from 3.2.0-rc.0)
|
- Fix bug: call onLoadStart 2 times(import from 3.2.0-rc.0)
|
||||||
|
|
|
@ -377,7 +377,9 @@ async function custom(context: Context, src: string | PixelMap | Resource,header
|
||||||
| onComplete | (event:EventImage、undefined) => void | 图片成功回调事件(可选) |
|
| onComplete | (event:EventImage、undefined) => void | 图片成功回调事件(可选) |
|
||||||
| onLoadListener | onLoadStart?: (req?: ImageKnifeRequest) => void,onLoadSuccess?: (data: string \| PixelMap \| undefined, imageData: ImageKnifeData, req?: ImageKnifeRequest) => void,onLoadFailed?: (err: string, req?: ImageKnifeRequest) => void,onLoadCancel?: (res: string, req?: ImageKnifeRequest) => void | 监听图片加载成功与失败 |
|
| onLoadListener | onLoadStart?: (req?: ImageKnifeRequest) => void,onLoadSuccess?: (data: string \| PixelMap \| undefined, imageData: ImageKnifeData, req?: ImageKnifeRequest) => void,onLoadFailed?: (err: string, req?: ImageKnifeRequest) => void,onLoadCancel?: (res: string, req?: ImageKnifeRequest) => void | 监听图片加载成功与失败 |
|
||||||
| downsampleOf | DownsampleStrategy | 降采样(可选) |
|
| downsampleOf | DownsampleStrategy | 降采样(可选) |
|
||||||
|
| connectTimeout | number | 连接超时时间(可选) |
|
||||||
|
| readTimeout | number | 读取超时时间(可选) |
|
||||||
|
| caPath | string | 协议证书(可选) |
|
||||||
### 降采样类型
|
### 降采样类型
|
||||||
| 类型 | 相关描述 |
|
| 类型 | 相关描述 |
|
||||||
|------------------------|-------------------|
|
|------------------------|-------------------|
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
"main": "index.ets",
|
"main": "index.ets",
|
||||||
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
"repository": "https://gitee.com/openharmony-tpc/ImageKnife",
|
||||||
"type": "module",
|
"type": "module",
|
||||||
"version": "3.2.0-rc.5",
|
"version": "3.2.0-rc.6",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@ohos/gpu_transform": "^1.0.2"
|
"@ohos/gpu_transform": "^1.0.2"
|
||||||
},
|
},
|
||||||
|
|
|
@ -251,7 +251,9 @@ export class ImageKnifeDispatcher {
|
||||||
downsampType: currentRequest.imageKnifeOption.downsampleOf == undefined ? DownsampleStrategy.DEFAULT : currentRequest.imageKnifeOption.downsampleOf,
|
downsampType: currentRequest.imageKnifeOption.downsampleOf == undefined ? DownsampleStrategy.DEFAULT : currentRequest.imageKnifeOption.downsampleOf,
|
||||||
isAutoImageFit: currentRequest.imageKnifeOption.objectFit == ImageFit.Auto,
|
isAutoImageFit: currentRequest.imageKnifeOption.objectFit == ImageFit.Auto,
|
||||||
componentId: currentRequest.componentId,
|
componentId: currentRequest.componentId,
|
||||||
componentVersion: currentRequest.componentVersion
|
componentVersion: currentRequest.componentVersion,
|
||||||
|
connectTimeout: currentRequest.imageKnifeOption.connectTimeout,
|
||||||
|
readTimeout: currentRequest.imageKnifeOption.readTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
if(request.customGetImage == undefined) {
|
if(request.customGetImage == undefined) {
|
||||||
|
@ -361,10 +363,10 @@ export class ImageKnifeDispatcher {
|
||||||
|
|
||||||
let pixelmap = requestJobResult.pixelMap;
|
let pixelmap = requestJobResult.pixelMap;
|
||||||
if (pixelmap === undefined) {
|
if (pixelmap === undefined) {
|
||||||
LogUtil.error('getAndShowImage_CallBack.pixelmap failed:' + currentRequest.componentId + ',srcType:' + requestSource + ',version:' + currentRequest.componentVersion + " error: " + requestJobResult.loadFail)
|
this.executingJobMap.remove(memoryKey);
|
||||||
requestList.forEach((requestWithSource: ImageKnifeRequestWithSource) => {
|
requestList.forEach((requestWithSource: ImageKnifeRequestWithSource) => {
|
||||||
requestWithSource.request.requestState = ImageKnifeRequestState.ERROR
|
requestWithSource.request.requestState = ImageKnifeRequestState.ERROR
|
||||||
this.executingJobMap.remove(memoryKey);
|
LogUtil.error('getAndShowImage_CallBack.pixelmap failed:' + currentRequest.componentId + ',srcType:' + requestSource + ',version:' + currentRequest.componentVersion + " error: " + requestJobResult.loadFail)
|
||||||
// 回调请求失败
|
// 回调请求失败
|
||||||
if (requestWithSource.source === ImageKnifeRequestSource.SRC &&
|
if (requestWithSource.source === ImageKnifeRequestSource.SRC &&
|
||||||
requestWithSource.request.imageKnifeOption.onLoadListener?.onLoadFailed !== undefined &&
|
requestWithSource.request.imageKnifeOption.onLoadListener?.onLoadFailed !== undefined &&
|
||||||
|
|
|
@ -525,8 +525,8 @@ export class ImageKnifeLoader {
|
||||||
header: headerObj,
|
header: headerObj,
|
||||||
method: http.RequestMethod.GET,
|
method: http.RequestMethod.GET,
|
||||||
expectDataType: http.HttpDataType.ARRAY_BUFFER,
|
expectDataType: http.HttpDataType.ARRAY_BUFFER,
|
||||||
connectTimeout: 60000,
|
connectTimeout: request.connectTimeout == undefined ? 60000 : request.connectTimeout,
|
||||||
readTimeout: 30000,
|
readTimeout: request.readTimeout == undefined ? 30000 : request.readTimeout,
|
||||||
// usingProtocol:http.HttpProtocol.HTTP1_1
|
// usingProtocol:http.HttpProtocol.HTTP1_1
|
||||||
// header: new Header('application/json')
|
// header: new Header('application/json')
|
||||||
caPath: request.caPath === undefined ? undefined : request.caPath,
|
caPath: request.caPath === undefined ? undefined : request.caPath,
|
||||||
|
|
|
@ -154,5 +154,7 @@ export interface RequestJobRequest {
|
||||||
isAutoImageFit: boolean,
|
isAutoImageFit: boolean,
|
||||||
componentId?: number,
|
componentId?: number,
|
||||||
componentVersion?: number
|
componentVersion?: number
|
||||||
|
connectTimeout?: number
|
||||||
|
readTimeout?: number
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -82,6 +82,8 @@ export class ImageKnifeOption {
|
||||||
downsampleOf?: DownsampleStrategy // 降采样
|
downsampleOf?: DownsampleStrategy // 降采样
|
||||||
// 自定义证书路径
|
// 自定义证书路径
|
||||||
caPath?: string
|
caPath?: string
|
||||||
|
connectTimeout?: number
|
||||||
|
readTimeout?: number
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,18 +17,26 @@ import { hilog } from '@kit.PerformanceAnalysisKit';
|
||||||
export class LogUtil {
|
export class LogUtil {
|
||||||
public static readonly DOMAIN: number = 0xD002220;
|
public static readonly DOMAIN: number = 0xD002220;
|
||||||
public static readonly TAG: string = 'ImageKnife::';
|
public static readonly TAG: string = 'ImageKnife::';
|
||||||
|
public static ON: number = 1
|
||||||
|
public static OFF: number = 2
|
||||||
|
public static mLogLevel:number = LogUtil.ON
|
||||||
public static debug(message: string, ...args: Object[]) {
|
public static debug(message: string, ...args: Object[]) {
|
||||||
|
if (LogUtil.mLogLevel == LogUtil.ON) {
|
||||||
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static info(message: string, ...args: Object[]) {
|
public static info(message: string, ...args: Object[]) {
|
||||||
|
if (LogUtil.mLogLevel == LogUtil.ON) {
|
||||||
hilog.info(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
hilog.info(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static log(message: string, ...args: Object[]) {
|
public static log(message: string, ...args: Object[]) {
|
||||||
|
if (LogUtil.mLogLevel == LogUtil.ON) {
|
||||||
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public static warn(message: string, ...args: Object[]) {
|
public static warn(message: string, ...args: Object[]) {
|
||||||
hilog.warn(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
hilog.warn(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
|
|
Loading…
Reference in New Issue