From e5b0d22e645cba193747c50b887b6b2dc09b8444 Mon Sep 17 00:00:00 2001 From: Olivier Poitrey Date: Tue, 6 Nov 2012 18:22:18 +0100 Subject: [PATCH] Do not break category API (cf previous commit) --- SDWebImage/MKAnnotationView+WebCache.m | 2 +- SDWebImage/SDWebImageManager.h | 5 +++-- SDWebImage/SDWebImageManager.m | 2 +- SDWebImage/UIButton+WebCache.m | 4 ++-- SDWebImage/UIImageView+WebCache.m | 2 +- 5 files changed, 8 insertions(+), 7 deletions(-) diff --git a/SDWebImage/MKAnnotationView+WebCache.m b/SDWebImage/MKAnnotationView+WebCache.m index 23fc1b88..dc97d9ba 100644 --- a/SDWebImage/MKAnnotationView+WebCache.m +++ b/SDWebImage/MKAnnotationView+WebCache.m @@ -49,7 +49,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) self.image = image; - if (completedBlock) completedBlock(image, error, fromCache, finished); + if (completedBlock) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } diff --git a/SDWebImage/SDWebImageManager.h b/SDWebImage/SDWebImageManager.h index 5229bdd1..3d20c776 100644 --- a/SDWebImage/SDWebImageManager.h +++ b/SDWebImage/SDWebImageManager.h @@ -19,7 +19,8 @@ typedef enum SDWebImageProgressiveDownload = 1 << 3 } SDWebImageOptions; -typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, BOOL fromCache, BOOL finished); +typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, BOOL fromCache); +typedef void(^SDWebImageCompletedWithFinishedBlock)(UIImage *image, NSError *error, BOOL fromCache, BOOL finished); /** @@ -95,7 +96,7 @@ typedef void(^SDWebImageCompletedBlock)(UIImage *image, NSError *error, BOOL fro - (id)downloadWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock - completed:(SDWebImageCompletedBlock)completedBlock; + completed:(SDWebImageCompletedWithFinishedBlock)completedBlock; /** * Cancel all current opreations diff --git a/SDWebImage/SDWebImageManager.m b/SDWebImage/SDWebImageManager.m index b88d40ce..58971724 100644 --- a/SDWebImage/SDWebImageManager.m +++ b/SDWebImage/SDWebImageManager.m @@ -60,7 +60,7 @@ } } -- (id)downloadWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedBlock)completedBlock +- (id)downloadWithURL:(NSURL *)url options:(SDWebImageOptions)options progress:(SDWebImageDownloaderProgressBlock)progressBlock completed:(SDWebImageCompletedWithFinishedBlock)completedBlock { // Very common mistake is to send the URL using NSString object instead of NSURL. For some strange reason, XCode won't // throw any warning for this type mismatch. Here we failsafe this error by allowing URLs to be passed as NSString. diff --git a/SDWebImage/UIButton+WebCache.m b/SDWebImage/UIButton+WebCache.m index 3419f63a..12dbc39e 100644 --- a/SDWebImage/UIButton+WebCache.m +++ b/SDWebImage/UIButton+WebCache.m @@ -48,7 +48,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) [self setImage:image forState:state]; - if (completedBlock) completedBlock(image, error, fromCache, finished); + if (completedBlock) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } @@ -90,7 +90,7 @@ static char operationKey; id operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) { if (image) [self setBackgroundImage:image forState:state]; - if (completedBlock) completedBlock(image, error, fromCache, finished); + if (completedBlock) completedBlock(image, error, fromCache); }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); } diff --git a/SDWebImage/UIImageView+WebCache.m b/SDWebImage/UIImageView+WebCache.m index 8e59a148..2d200488 100644 --- a/SDWebImage/UIImageView+WebCache.m +++ b/SDWebImage/UIImageView+WebCache.m @@ -60,7 +60,7 @@ static char operationKey; } if (completedBlock) { - completedBlock(image, error, fromCache, finished); + completedBlock(image, error, fromCache); } }]; objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);