Inline conditions are baaad

This commit is contained in:
Olivier Poitrey 2012-11-06 18:28:14 +01:00
parent b29bb2e2e1
commit 95be2aad35
2 changed files with 24 additions and 6 deletions

View File

@ -48,8 +48,14 @@ static char operationKey;
{ {
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished)
{ {
if (image) self.image = image; if (image)
if (completedBlock && finished) completedBlock(image, error, fromCache); {
self.image = image;
}
if (completedBlock && finished)
{
completedBlock(image, error, fromCache);
}
}]; }];
objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }

View File

@ -47,8 +47,14 @@ static char operationKey;
{ {
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) id<SDWebImageOperation> 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 (image)
if (completedBlock && finished) completedBlock(image, error, fromCache); {
[self setImage:image forState:state];
}
if (completedBlock && finished)
{
completedBlock(image, error, fromCache);
}
}]; }];
objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }
@ -89,8 +95,14 @@ static char operationKey;
{ {
id<SDWebImageOperation> operation = [SDWebImageManager.sharedManager downloadWithURL:url options:options progress:nil completed:^(UIImage *image, NSError *error, BOOL fromCache, BOOL finished) id<SDWebImageOperation> 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 (image)
if (completedBlock && finished) completedBlock(image, error, fromCache); {
[self setBackgroundImage:image forState:state];
}
if (completedBlock && finished)
{
completedBlock(image, error, fromCache);
}
}]; }];
objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC); objc_setAssociatedObject(self, &operationKey, operation, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
} }