Pre Merge pull request !417 from jinzhao/3.x

This commit is contained in:
jinzhao 2024-10-31 09:33:17 +00:00 committed by Gitee
commit f303360ddf
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
5 changed files with 13 additions and 2 deletions

View File

@ -76,7 +76,9 @@ struct SingleImage {
placeholderSrc: $r("app.media.loading"),
errorholderSrc: $r("app.media.failed"),
objectFit: ImageFit.Contain,
progressListener:(progress:number)=>{console.info("ImageKnife:: call back progress = " + progress)}
progressListener:(progress:number)=>{console.info("ImageKnife:: call back progress = " + progress)},
// 通过https协议进行连接时默认使用系统预设CA证书。若希望使用自定义证书进行https连接则需要将自定义证书上传至应用沙箱目录中并在caPath中指定该证书所在的应用沙箱路径
// caPath: "/data/storage/el1/bundle/ca.pem",
}
}).width(100).height(100)
Text($r('app.string.Custom_network_download'))

View File

@ -254,7 +254,8 @@ export class ImageKnifeDispatcher {
fileCacheFolder: ImageKnife.getInstance().getFileCache()?.getCacheFolder(),
isAnimator:isAnimator,
moduleName: moduleName == "" ? undefined : moduleName,
resName: resName == "" ? undefined : resName
resName: resName == "" ? undefined : resName,
caPath: currentRequest.imageKnifeOption.caPath,
}
if(request.customGetImage == undefined) {

View File

@ -454,6 +454,7 @@ export class ImageKnifeLoader {
readTimeout: 0,
// usingProtocol:http.HttpProtocol.HTTP1_1
// header: new Header('application/json')
caPath: request.caPath === undefined ? undefined : request.caPath,
});
promise.then((data: number) => {

View File

@ -146,5 +146,6 @@ export interface RequestJobRequest {
isAnimator?: boolean,
moduleName?:string,
resName?: string
caPath?: string,
}

View File

@ -44,6 +44,10 @@ export class AnimatorOption {
onRepeat?:()=>void
}
interface ImageOption {
// 自定义证书路径
caPath?: string,
}
@Observed
export class ImageKnifeOption {
// 主图资源
@ -74,6 +78,8 @@ export class ImageKnifeOption {
onLoadListener?: OnLoadCallBack | undefined;
onComplete?:(event:EventImage | undefined) => void
drawingColorFilter?: ColorFilter | drawing.ColorFilter
// 自定义证书路径
caPath?: string
constructor() {
}