diff --git a/CHANGELOG.md b/CHANGELOG.md index cae97f0..fcaf96b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,8 @@ - The sub-thread network request is changed to asynchronous, thereby increasing the number of concurrent sub-thread network requests - Set the concurrency through the setMaxRequests interface under the ImageKnife class - aboutToRecycle life cycle clear image content +- Fixed bug for receive only the first onLoadStart for concurrent identical requests +- Modify the condition for determining whether to queue to be greater than or equal to maxRequests ## 3.0.3 - Released version 3.0.3 diff --git a/library/src/main/ets/ImageKnifeDispatcher.ets b/library/src/main/ets/ImageKnifeDispatcher.ets index a6a2af6..0272046 100644 --- a/library/src/main/ets/ImageKnifeDispatcher.ets +++ b/library/src/main/ets/ImageKnifeDispatcher.ets @@ -104,7 +104,7 @@ export class ImageKnifeDispatcher { } } //3.判断是否要排队 - if (this.executingJobMap.length > this.maxRequests) { + if (this.executingJobMap.length >= this.maxRequests) { this.jobQueue.add(request) return } @@ -128,6 +128,11 @@ export class ImageKnifeDispatcher { */ getAndShowImage(currentRequest: ImageKnifeRequest, imageSrc: string | PixelMap | Resource, requestSource: ImageKnifeRequestSource,isAnimator?: boolean): void { LogUtil.log("ImageKnife_DataTime_getAndShowImage.start:" + currentRequest.imageKnifeOption.loadSrc) + if (requestSource === ImageKnifeRequestSource.SRC && currentRequest.imageKnifeOption.onLoadListener?.onLoadStart !== undefined) { + currentRequest.imageKnifeOption.onLoadListener?.onLoadStart() + LogUtil.log("ImageKnife_DataTime_getAndShowImage_onLoadStart:" + currentRequest.imageKnifeOption.loadSrc) + } + let memoryKey: string = this.engineKey.generateMemoryKey(imageSrc, requestSource, currentRequest.imageKnifeOption,isAnimator) let requestList: List | undefined = this.executingJobMap.get(memoryKey) if (requestList == undefined) { @@ -140,6 +145,9 @@ export class ImageKnifeDispatcher { } let isWatchProgress : boolean = false + if (currentRequest.imageKnifeOption.progressListener !== undefined && requestSource === ImageKnifeRequestSource.SRC) { + isWatchProgress = true + } // 回调请求开始 requestList.forEach((requestWithSource: ImageKnifeRequestWithSource) => {