Merge pull request #2437 from dreampiggy/bugfix_view_progress_indicator
Fix the bug that progress indicator on macOS stop at 1% but not 100% when download finished
This commit is contained in:
commit
64a2453527
|
@ -192,7 +192,7 @@
|
||||||
}
|
}
|
||||||
#else
|
#else
|
||||||
self.indicatorView.indeterminate = NO;
|
self.indicatorView.indeterminate = NO;
|
||||||
self.indicatorView.doubleValue = 1;
|
self.indicatorView.doubleValue = 100;
|
||||||
[self.indicatorView stopAnimation:nil];
|
[self.indicatorView stopAnimation:nil];
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,9 +83,6 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL;
|
||||||
NSProgress *imageProgress = sself.sd_imageProgress;
|
NSProgress *imageProgress = sself.sd_imageProgress;
|
||||||
imageProgress.totalUnitCount = expectedSize;
|
imageProgress.totalUnitCount = expectedSize;
|
||||||
imageProgress.completedUnitCount = receivedSize;
|
imageProgress.completedUnitCount = receivedSize;
|
||||||
if (progressBlock) {
|
|
||||||
progressBlock(receivedSize, expectedSize, targetURL);
|
|
||||||
}
|
|
||||||
#if SD_UIKIT || SD_MAC
|
#if SD_UIKIT || SD_MAC
|
||||||
if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) {
|
if ([imageIndicator respondsToSelector:@selector(updateIndicatorProgress:)]) {
|
||||||
double progress = imageProgress.fractionCompleted;
|
double progress = imageProgress.fractionCompleted;
|
||||||
|
@ -94,6 +91,9 @@ const int64_t SDWebImageProgressUnitCountUnknown = 1LL;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
if (progressBlock) {
|
||||||
|
progressBlock(receivedSize, expectedSize, targetURL);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
id <SDWebImageOperation> operation = [manager loadImageWithURL:url options:options context:context progress:combinedProgressBlock completed:^(UIImage *image, NSData *data, NSError *error, SDImageCacheType cacheType, BOOL finished, NSURL *imageURL) {
|
id <SDWebImageOperation> 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;
|
__strong __typeof (wself) sself = wself;
|
||||||
|
|
Loading…
Reference in New Issue