Added the API to remove failed URLs from black list, since now we populate the error code and user can know which URL get blocked

This commit is contained in:
DreamPiggy 2020-04-29 21:49:48 +08:00
parent 0dd1d42397
commit 0ba0aaca34
2 changed files with 26 additions and 0 deletions

View File

@ -261,6 +261,17 @@ SDWebImageManager *manager = [SDWebImageManager sharedManager];
*/ */
- (void)cancelAll; - (void)cancelAll;
/**
* Remove the specify URL from failed black list.
* @param url The failed URL.
*/
- (void)removeFailedURL:(nonnull NSURL *)url;
/**
* Remove all the URL from failed black list.
*/
- (void)removeAllFailedURLs;
/** /**
* Return the cache key for a given URL, does not considerate transformer or thumbnail. * Return the cache key for a given URL, does not considerate transformer or thumbnail.
* @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key. * @note This method does not have context option, only use the url and manager level cacheKeyFilter to generate the cache key.

View File

@ -228,6 +228,21 @@ static id<SDImageLoader> _defaultImageLoader;
return isRunning; return isRunning;
} }
- (void)removeFailedURL:(NSURL *)url {
if (!url) {
return;
}
SD_LOCK(self.failedURLsLock);
[self.failedURLs removeObject:url];
SD_UNLOCK(self.failedURLsLock);
}
- (void)removeAllFailedURLs {
SD_LOCK(self.failedURLsLock);
[self.failedURLs removeAllObjects];
SD_UNLOCK(self.failedURLsLock);
}
#pragma mark - Private #pragma mark - Private
// Query normal cache process // Query normal cache process