From 69f951b290bf9d85efd186d6592de9bd4fca7853 Mon Sep 17 00:00:00 2001 From: zgf Date: Fri, 2 Aug 2024 16:25:41 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=8A=A8=E5=9B=BE=E6=8E=A7?= =?UTF-8?q?=E5=88=B6=E7=BB=84=E4=BB=B6=E5=88=9D=E5=A7=8B=E5=80=BC=E5=A4=B1?= =?UTF-8?q?=E6=95=88=E3=80=81=E7=BD=91=E7=BB=9C=E8=AF=B7=E6=B1=82=E6=88=90?= =?UTF-8?q?=E5=8A=9Fcode=E4=BB=A5=E5=8F=8A=E6=96=87=E4=BB=B6=E7=BC=93?= =?UTF-8?q?=E5=AD=98=E5=8F=AF=E9=80=89=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zgf --- CHANGELOG.md | 5 ++++ library/src/main/ets/ImageKnifeDispatcher.ets | 4 ++-- .../ImageKnifeAnimatorComponent.ets | 23 ++++--------------- 3 files changed, 11 insertions(+), 21 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2c5d7cc..47f7685 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 3.0.1 +- 修复animatorOption属性设置初始化值失效 +- 网络请求code为206、204时返回arraybuffer +- ImageKnifeComponent显示非必要文件缓存初始化 + ## 3.0.1-rc.2 - 修复自定义下载失败无失败回调 - 增加全局配置自定义下载接口 diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index 795d709..ed3e306 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -175,7 +175,7 @@ export class ImageKnifeDispatcher { requestSource: requestSource, isWatchProgress: isWatchProgress, memoryKey: memoryKey, - fileCacheFolder: ImageKnife.getInstance().getFileCache().getCacheFolder(), + fileCacheFolder: ImageKnife.getInstance().getFileCache()?.getCacheFolder(), isAnimator:isAnimator } @@ -467,7 +467,7 @@ async function requestJob(request: RequestJobRequest, requestList?: List { - if (data == 200) { + if (data == 200 || data == 206 || data == 204) { resBuf = combineArrayBuffers(arrayBuffers) } else { loadError = "HttpDownloadClient has error, http code =" + JSON.stringify(data) diff --git a/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets b/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets index 2e1671f..f3bc678 100644 --- a/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets +++ b/library/src/main/ets/components/ImageKnifeAnimatorComponent.ets @@ -22,12 +22,9 @@ import { ImageKnifeRequestSource } from '../model/ImageKnifeData'; @Component export struct ImageKnifeAnimatorComponent { @Watch('watchImageKnifeOption') @ObjectLink imageKnifeOption: ImageKnifeOption; - @Watch('watchAnimatorOption') @State animatorOption: AnimatorOption = new AnimatorOption(); + @State animatorOption: AnimatorOption = new AnimatorOption(); @State pixelMap: PixelMap | string | undefined = undefined @State imageAnimator: Array | undefined = undefined - @State state: AnimationStatus = AnimationStatus.Running - @State iterations: number = -1 - @State reverse: boolean = false @State adaptiveWidth: Length = '100%' @State adaptiveHeight: Length = '100%' @State objectFit: ImageFit = ImageFit.Contain @@ -64,9 +61,9 @@ export struct ImageKnifeAnimatorComponent { .width(this.adaptiveWidth) .height(this.adaptiveHeight) .border(this.imageKnifeOption.border) - .state(this.state) - .iterations(this.iterations) - .reverse(this.reverse) + .state(this.animatorOption.state == undefined ? AnimationStatus.Running : this.animatorOption.state) + .iterations(this.animatorOption.iterations == undefined ? -1 : this.animatorOption.iterations) + .reverse(this.animatorOption.reverse == undefined ? false : this.animatorOption.reverse) .onSizeChange((oldValue:SizeOptions, newValue:SizeOptions) => { this.currentWidth = newValue.width as number this.currentHeight = newValue.height as number @@ -84,18 +81,6 @@ export struct ImageKnifeAnimatorComponent { }) } - watchAnimatorOption(){ - if(this.animatorOption.state != undefined) { - this.state = this.animatorOption.state - } - if(this.animatorOption.iterations != undefined) { - this.iterations = this.animatorOption.iterations - } - if(this.animatorOption.reverse != undefined) { - this.reverse = this.animatorOption.reverse - } - } - watchImageKnifeOption() { if (this.request !== undefined) { this.request.requestState = ImageKnifeRequestState.DESTROY