Authored by Olivier Poitrey

Fix SDWebImagePrefetcher maxConcurrentDownloads property

... ... @@ -35,12 +35,21 @@
if ((self = [super init]))
{
_manager = SDWebImageManager.new;
_manager.imageDownloader.maxConcurrentDownloads = 3;
_options = SDWebImageLowPriority;
self.maxConcurrentDownloads = 3;
}
return self;
}
- (void)setMaxConcurrentDownloads:(NSUInteger)maxConcurrentDownloads
{
self.manager.imageDownloader.maxConcurrentDownloads = maxConcurrentDownloads;
}
- (NSUInteger)maxConcurrentDownloads
{
return self.manager.imageDownloader.maxConcurrentDownloads;
}
- (void)startPrefetchingAtIndex:(NSUInteger)index
{
... ... @@ -88,7 +97,7 @@
// Starts prefetching from the very first image on the list with the max allowed concurrency
NSUInteger listCount = self.prefetchURLs.count;
for (NSUInteger i = 0; i < self.manager.imageDownloader.maxConcurrentDownloads && self.requestedCount < listCount; i++)
for (NSUInteger i = 0; i < self.maxConcurrentDownloads && self.requestedCount < listCount; i++)
{
[self startPrefetchingAtIndex:i];
}
... ...