Fix the support for `SDImageLoadersManager` for canRequest API check, should be compatible with both old and new API
This commit is contained in:
parent
a72df48494
commit
4274158949
|
@ -78,10 +78,20 @@
|
|||
#pragma mark - SDImageLoader
|
||||
|
||||
- (BOOL)canRequestImageForURL:(nullable NSURL *)url {
|
||||
return [self canRequestImageForURL:url options:0 context:nil];
|
||||
}
|
||||
|
||||
- (BOOL)canRequestImageForURL:(NSURL *)url options:(SDWebImageOptions)options context:(SDWebImageContext *)context {
|
||||
NSArray<id<SDImageLoader>> *loaders = self.loaders;
|
||||
for (id<SDImageLoader> loader in loaders.reverseObjectEnumerator) {
|
||||
if ([loader canRequestImageForURL:url]) {
|
||||
return YES;
|
||||
if ([loader respondsToSelector:@selector(canRequestImageForURL:options:context:)]) {
|
||||
if ([loader canRequestImageForURL:url options:options context:context]) {
|
||||
return YES;
|
||||
}
|
||||
} else {
|
||||
if ([loader canRequestImageForURL:url]) {
|
||||
return YES;
|
||||
}
|
||||
}
|
||||
}
|
||||
return NO;
|
||||
|
|
Loading…
Reference in New Issue