diff --git a/CHANGELOG.md b/CHANGELOG.md index 5f17062..843383b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.0-rc.8 +- svg解码单位改为px +- 修复预加载接口preLoadCache传ImageKnifeOption失效 +- 文件缓存初始化接口新增目录参数 + ## 3.0.0-rc.7 - 修复成功回调获取不到宽高 - 新增svg图片解码 diff --git a/library/oh-package.json5 b/library/oh-package.json5 index a584ba0..c206a0f 100644 --- a/library/oh-package.json5 +++ b/library/oh-package.json5 @@ -14,7 +14,7 @@ "main": "index.ets", "repository": "https://gitee.com/openharmony-tpc/ImageKnife", "type": "module", - "version": "3.0.0-rc.7", + "version": "3.0.0-rc.8", "dependencies": { "@ohos/gpu_transform": "^1.0.2" }, diff --git a/library/src/main/ets/ImageKnife.ets b/library/src/main/ets/ImageKnife.ets index 19b4d08..e58fadd 100644 --- a/library/src/main/ets/ImageKnife.ets +++ b/library/src/main/ets/ImageKnife.ets @@ -65,9 +65,13 @@ export class ImageKnife { * @param size 缓存数量 * @param memory 内存大小 */ - async initFileCache(context: Context, size: number = 256, memory: number = 256 * 1024 * 1024) { + async initFileCache(context: Context, size: number = 256, memory: number = 256 * 1024 * 1024,path?: string) { this.fileCache = new FileCache(context, size, memory) - await this.fileCache.initFileCache() + if ( path != undefined ) { + await this.fileCache.initFileCache(path) + } else { + await this.fileCache.initFileCache() + } } /** @@ -166,10 +170,10 @@ export class ImageKnife { preLoadCache(loadSrc: string | ImageKnifeOption): Promise { return new Promise((resolve, reject) => { let imageKnifeOption = new ImageKnifeOption() - if (loadSrc instanceof ImageKnifeOption) { - imageKnifeOption = loadSrc + if (typeof loadSrc == "string") { + imageKnifeOption.loadSrc = loadSrc } else { - imageKnifeOption.loadSrc = loadSrc; + imageKnifeOption = loadSrc; } LogUtil.log("ImageKnife_DataTime_preLoadCache-imageKnifeOption:"+loadSrc) let fileKey = this.getEngineKeyImpl().generateFileKey(imageKnifeOption.loadSrc, imageKnifeOption.signature) diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index 56b81c3..03d7a70 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -171,7 +171,8 @@ export class ImageKnifeDispatcher { signature: currentRequest.imageKnifeOption.signature, requestSource: requestSource, isWatchProgress: isWatchProgress, - memoryKey: memoryKey + memoryKey: memoryKey, + fileCacheFolder: ImageKnife.getInstance().getFileCache().getCacheFolder() } @@ -373,7 +374,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List