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:
Bogdan Poplauschi 2018-08-10 17:35:07 +03:00 committed by GitHub
commit 64a2453527
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -192,7 +192,7 @@
}
#else
self.indicatorView.indeterminate = NO;
self.indicatorView.doubleValue = 1;
self.indicatorView.doubleValue = 100;
[self.indicatorView stopAnimation:nil];
#endif
}

View File

@ -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 <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;