From 41b0a0421e43289491f0639dc3c11c852976e48c Mon Sep 17 00:00:00 2001 From: DreamPiggy Date: Fri, 10 Aug 2018 21:28:27 +0800 Subject: [PATCH] Fix the mistake cause a bug that progress indicator on macOS stop at 1% but not 100% when download finished... --- SDWebImage/SDWebImageIndicator.m | 2 +- SDWebImage/UIView+WebCache.m | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/SDWebImage/SDWebImageIndicator.m b/SDWebImage/SDWebImageIndicator.m index 53830a37..bec23fbc 100644 --- a/SDWebImage/SDWebImageIndicator.m +++ b/SDWebImage/SDWebImageIndicator.m @@ -192,7 +192,7 @@ } #else self.indicatorView.indeterminate = NO; - self.indicatorView.doubleValue = 1; + self.indicatorView.doubleValue = 100; [self.indicatorView stopAnimation:nil]; #endif } diff --git a/SDWebImage/UIView+WebCache.m b/SDWebImage/UIView+WebCache.m index 8a73d740..d3b7ef61 100644 --- a/SDWebImage/UIView+WebCache.m +++ b/SDWebImage/UIView+WebCache.m @@ -83,9 +83,6 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL; NSProgress *imageProgress = sself.sd_imageProgress; imageProgress.totalUnitCount = expectedSize; imageProgress.completedUnitCount = receivedSize; - if (progressBlock) { - progressBlock(receivedSize, expectedSize, targetURL); - } #if SD_UIKIT || SD_MAC if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) { double progress = imageProgress.fractionCompleted; @@ -94,6 +91,9 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL; }); } #endif + if (progressBlock) { + progressBlock(receivedSize, expectedSize, targetURL); + } }; id operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) { __strong __typeof (wself) sself = wself;