Whitespace formatting

This commit is contained in:
Mattt Thompson 2013-01-26 10:31:16 -05:00
parent cd8cee4ac8
commit d9da9e5c1a

View file

@ -1,17 +1,17 @@
// UIImageView+AFNetworking.m // UIImageView+AFNetworking.m
// //
// Copyright (c) 2011 Gowalla (http://gowalla.com/) // Copyright (c) 2011 Gowalla (http://gowalla.com/)
// //
// Permission is hereby granted, free of charge, to any person obtaining a copy // Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal // of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights // in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is // copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: // furnished to do so, subject to the following conditions:
// //
// The above copyright notice and this permission notice shall be included in // The above copyright notice and this permission notice shall be included in
// all copies or substantial portions of the Software. // all copies or substantial portions of the Software.
// //
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
@ -63,7 +63,7 @@ static char kAFImageRequestOperationObjectKey;
_af_imageRequestOperationQueue = [[NSOperationQueue alloc] init]; _af_imageRequestOperationQueue = [[NSOperationQueue alloc] init];
[_af_imageRequestOperationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount]; [_af_imageRequestOperationQueue setMaxConcurrentOperationCount:NSOperationQueueDefaultMaxConcurrentOperationCount];
}); });
return _af_imageRequestOperationQueue; return _af_imageRequestOperationQueue;
} }
@ -73,7 +73,7 @@ static char kAFImageRequestOperationObjectKey;
dispatch_once(&oncePredicate, ^{ dispatch_once(&oncePredicate, ^{
_af_imageCache = [[AFImageCache alloc] init]; _af_imageCache = [[AFImageCache alloc] init];
}); });
return _af_imageCache; return _af_imageCache;
} }
@ -83,34 +83,34 @@ static char kAFImageRequestOperationObjectKey;
[self setImageWithURL:url placeholderImage:nil]; [self setImageWithURL:url placeholderImage:nil];
} }
- (void)setImageWithURL:(NSURL *)url - (void)setImageWithURL:(NSURL *)url
placeholderImage:(UIImage *)placeholderImage placeholderImage:(UIImage *)placeholderImage
{ {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url]; NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url];
[request setHTTPShouldHandleCookies:NO]; [request setHTTPShouldHandleCookies:NO];
[request addValue:@"image/*" forHTTPHeaderField:@"Accept"]; [request addValue:@"image/*" forHTTPHeaderField:@"Accept"];
[self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil]; [self setImageWithURLRequest:request placeholderImage:placeholderImage success:nil failure:nil];
} }
- (void)setImageWithURLRequest:(NSURLRequest *)urlRequest - (void)setImageWithURLRequest:(NSURLRequest *)urlRequest
placeholderImage:(UIImage *)placeholderImage placeholderImage:(UIImage *)placeholderImage
success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success success:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, UIImage *image))success
failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure failure:(void (^)(NSURLRequest *request, NSHTTPURLResponse *response, NSError *error))failure
{ {
[self cancelImageRequestOperation]; [self cancelImageRequestOperation];
UIImage *cachedImage = [[[self class] af_sharedImageCache] cachedImageForRequest:urlRequest]; UIImage *cachedImage = [[[self class] af_sharedImageCache] cachedImageForRequest:urlRequest];
if (cachedImage) { if (cachedImage) {
self.image = cachedImage; self.image = cachedImage;
self.af_imageRequestOperation = nil; self.af_imageRequestOperation = nil;
if (success) { if (success) {
success(nil, nil, cachedImage); success(nil, nil, cachedImage);
} }
} else { } else {
self.image = placeholderImage; self.image = placeholderImage;
AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest]; AFImageRequestOperation *requestOperation = [[AFImageRequestOperation alloc] initWithRequest:urlRequest];
[requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) { [requestOperation setCompletionBlockWithSuccess:^(AFHTTPRequestOperation *operation, id responseObject) {
if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) { if ([[urlRequest URL] isEqual:[[self.af_imageRequestOperation request] URL]]) {
@ -121,7 +121,7 @@ static char kAFImageRequestOperationObjectKey;
} }
if (self.af_imageRequestOperation == operation) { if (self.af_imageRequestOperation == operation) {
self.af_imageRequestOperation = nil; self.af_imageRequestOperation = nil;
} }
} }
@ -133,7 +133,7 @@ static char kAFImageRequestOperationObjectKey;
} }
if (self.af_imageRequestOperation == operation) { if (self.af_imageRequestOperation == operation) {
self.af_imageRequestOperation = nil; self.af_imageRequestOperation = nil;
} }
} }
}]; }];
@ -167,7 +167,7 @@ static inline NSString * AFImageCacheKeyFromURLRequest(NSURLRequest *request) {
default: default:
break; break;
} }
return [self objectForKey:AFImageCacheKeyFromURLRequest(request)]; return [self objectForKey:AFImageCacheKeyFromURLRequest(request)];
} }