|
@@ -37,20 +37,22 @@
|
|
|
return instance;
|
|
return instance;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (id)init {
|
|
|
|
|
|
|
+- (instancetype)init {
|
|
|
|
|
+ SDImageCache *cache = [SDImageCache sharedImageCache];
|
|
|
|
|
+ SDWebImageDownloader *downloader = [SDWebImageDownloader sharedDownloader];
|
|
|
|
|
+ return [self initWithCache:cache downloader:downloader];
|
|
|
|
|
+}
|
|
|
|
|
+
|
|
|
|
|
+- (instancetype)initWithCache:(SDImageCache *)cache downloader:(SDWebImageDownloader *)downloader {
|
|
|
if ((self = [super init])) {
|
|
if ((self = [super init])) {
|
|
|
- _imageCache = [self createCache];
|
|
|
|
|
- _imageDownloader = [SDWebImageDownloader sharedDownloader];
|
|
|
|
|
|
|
+ _imageCache = cache;
|
|
|
|
|
+ _imageDownloader = downloader;
|
|
|
_failedURLs = [NSMutableSet new];
|
|
_failedURLs = [NSMutableSet new];
|
|
|
_runningOperations = [NSMutableArray new];
|
|
_runningOperations = [NSMutableArray new];
|
|
|
}
|
|
}
|
|
|
return self;
|
|
return self;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
-- (SDImageCache *)createCache {
|
|
|
|
|
- return [SDImageCache sharedImageCache];
|
|
|
|
|
-}
|
|
|
|
|
-
|
|
|
|
|
- (NSString *)cacheKeyForURL:(NSURL *)url {
|
|
- (NSString *)cacheKeyForURL:(NSURL *)url {
|
|
|
if (self.cacheKeyFilter) {
|
|
if (self.cacheKeyFilter) {
|
|
|
return self.cacheKeyFilter(url);
|
|
return self.cacheKeyFilter(url);
|