Compare commits
2 Commits
d7d9e371ba
...
a5c9e6f289
Author | SHA1 | Date |
---|---|---|
|
a5c9e6f289 | |
|
68672e1dc7 |
|
@ -1,6 +1,6 @@
|
||||||
## 3.2.0-rc.6
|
## 3.2.0-rc.6
|
||||||
- LogUtil adds switch
|
- Support LogUtil to turn off log
|
||||||
- ImageKnifeOption adds network request timeout parameter
|
- Support set network request readTimeout and connectTimeout through ImageKnifeOption
|
||||||
|
|
||||||
## 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
|
||||||
|
|
|
@ -377,9 +377,8 @@ 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 | 连接超时时间(可选) |
|
| httpOption | httpRequestOption | 网络请求配置(可选) |
|
||||||
| readTimeout | number | 读取超时时间(可选) |
|
|
||||||
| caPath | string | 协议证书(可选) |
|
|
||||||
### 降采样类型
|
### 降采样类型
|
||||||
| 类型 | 相关描述 |
|
| 类型 | 相关描述 |
|
||||||
|------------------------|-------------------|
|
|------------------------|-------------------|
|
||||||
|
|
|
@ -30,6 +30,10 @@ struct LongImagePage {
|
||||||
//src:$r('app.media.aaa'),
|
//src:$r('app.media.aaa'),
|
||||||
placeholderSrc: $r('app.media.loading'),
|
placeholderSrc: $r('app.media.loading'),
|
||||||
errorholderSrc: $r('app.media.failed'),
|
errorholderSrc: $r('app.media.failed'),
|
||||||
|
httpOption: {
|
||||||
|
connectTimeout: 60000,
|
||||||
|
readTimeout: 60000
|
||||||
|
},
|
||||||
objectFit: ImageFit.Auto
|
objectFit: ImageFit.Auto
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
@ -18,7 +18,7 @@ export { ImageKnifeAnimatorComponent } from './src/main/ets/components/ImageKnif
|
||||||
|
|
||||||
export { ImageKnife } from './src/main/ets/ImageKnife'
|
export { ImageKnife } from './src/main/ets/ImageKnife'
|
||||||
|
|
||||||
export { ImageKnifeOption , AnimatorOption } from './src/main/ets/model/ImageKnifeOption'
|
export { ImageKnifeOption , AnimatorOption,httpRequestOption,HeaderOptions } from './src/main/ets/model/ImageKnifeOption'
|
||||||
|
|
||||||
export { ImageKnifeRequest } from './src/main/ets/model/ImageKnifeRequest'
|
export { ImageKnifeRequest } from './src/main/ets/model/ImageKnifeRequest'
|
||||||
|
|
||||||
|
|
|
@ -245,15 +245,15 @@ export class ImageKnifeDispatcher {
|
||||||
isAnimator:isAnimator,
|
isAnimator:isAnimator,
|
||||||
moduleName: moduleName == '' ? undefined : moduleName,
|
moduleName: moduleName == '' ? undefined : moduleName,
|
||||||
resName: resName == '' ? undefined : resName,
|
resName: resName == '' ? undefined : resName,
|
||||||
caPath: currentRequest.imageKnifeOption.caPath,
|
caPath: currentRequest.imageKnifeOption.httpOption?.caPath,
|
||||||
targetWidth: currentRequest.componentWidth,
|
targetWidth: currentRequest.componentWidth,
|
||||||
targetHeight: currentRequest.componentHeight,
|
targetHeight: currentRequest.componentHeight,
|
||||||
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,
|
connectTimeout: currentRequest.imageKnifeOption.httpOption?.connectTimeout,
|
||||||
readTimeout: currentRequest.imageKnifeOption.readTimeout
|
readTimeout: currentRequest.imageKnifeOption.httpOption?.readTimeout
|
||||||
}
|
}
|
||||||
|
|
||||||
if(request.customGetImage == undefined) {
|
if(request.customGetImage == undefined) {
|
||||||
|
|
|
@ -45,9 +45,10 @@ export class AnimatorOption {
|
||||||
onRepeat?:()=>void
|
onRepeat?:()=>void
|
||||||
}
|
}
|
||||||
|
|
||||||
interface ImageOption {
|
export interface httpRequestOption {
|
||||||
// 自定义证书路径
|
caPath?: string // 自定义证书路径
|
||||||
caPath?: string,
|
connectTimeout?: number // 连接超时
|
||||||
|
readTimeout?: number // 读取超时
|
||||||
}
|
}
|
||||||
@Observed
|
@Observed
|
||||||
export class ImageKnifeOption {
|
export class ImageKnifeOption {
|
||||||
|
@ -81,9 +82,7 @@ export class ImageKnifeOption {
|
||||||
drawingColorFilter?: ColorFilter | drawing.ColorFilter
|
drawingColorFilter?: ColorFilter | drawing.ColorFilter
|
||||||
downsampleOf?: DownsampleStrategy // 降采样
|
downsampleOf?: DownsampleStrategy // 降采样
|
||||||
// 自定义证书路径
|
// 自定义证书路径
|
||||||
caPath?: string
|
httpOption?: httpRequestOption
|
||||||
connectTimeout?: number
|
|
||||||
readTimeout?: number
|
|
||||||
constructor() {
|
constructor() {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,9 +17,9 @@ 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 ON: boolean = true
|
||||||
public static OFF: number = 2
|
public static OFF: boolean = false
|
||||||
public static mLogLevel:number = LogUtil.ON
|
public static mLogLevel:boolean = LogUtil.ON
|
||||||
public static debug(message: string, ...args: Object[]) {
|
public static debug(message: string, ...args: Object[]) {
|
||||||
if (LogUtil.mLogLevel == LogUtil.ON) {
|
if (LogUtil.mLogLevel == LogUtil.ON) {
|
||||||
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
hilog.debug(LogUtil.DOMAIN, LogUtil.TAG, message, args)
|
||||||
|
|
|
@ -22,7 +22,7 @@ export { ImageKnifeComponent,ImageKnifeAnimatorComponent } from '@ohos/imageknif
|
||||||
|
|
||||||
export { ImageKnife } from '@ohos/imageknife'
|
export { ImageKnife } from '@ohos/imageknife'
|
||||||
|
|
||||||
export { ImageKnifeOption,AnimatorOption } from '@ohos/imageknife'
|
export { ImageKnifeOption,AnimatorOption,httpRequestOption,HeaderOptions } from '@ohos/imageknife'
|
||||||
|
|
||||||
export { DownsampleStrategy } from "@ohos/imageknife"
|
export { DownsampleStrategy } from "@ohos/imageknife"
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue