Mark depreciated protocols with deprivation attribute

This commit is contained in:
Eric Jensen
2016-03-08 09:59:46 -08:00
parent 84357c4a48
commit c2f85397ce
4 changed files with 22 additions and 5 deletions

View File

@@ -737,10 +737,13 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
completionBlock(imageFromCache);
}];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_cache fetchCachedImageWithURL:imageURL callbackQueue:dispatch_get_main_queue() completion:^(CGImageRef coreGraphicsImageFromCache) {
UIImage *imageFromCache = (coreGraphicsImageFromCache ? [UIImage imageWithCGImage:coreGraphicsImageFromCache] : nil);
completionBlock(imageFromCache);
}];
#pragma clang diagnostic pop
}
}
// If we don't have a cache, just fail immediately.
@@ -795,6 +798,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
[strongSelf->_delegate multiplexImageNode:weakSelf didFinishDownloadingImageWithIdentifier:imageIdentifier error:error];
}]];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[self _setDownloadIdentifier:[_downloader downloadImageWithURL:imageURL
callbackQueue:dispatch_get_main_queue()
downloadProgressBlock:downloadProgressBlock
@@ -811,6 +816,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
if (strongSelf->_delegateFlags.downloadFinish)
[strongSelf->_delegate multiplexImageNode:weakSelf didFinishDownloadingImageWithIdentifier:imageIdentifier error:error];
}]];
#pragma clang diagnostic pop
}
});
}

View File

@@ -295,6 +295,8 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
}
}];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
_downloadIdentifier = [_downloader downloadImageWithURL:_URL
callbackQueue:dispatch_get_main_queue()
downloadProgressBlock:NULL
@@ -303,6 +305,7 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
finished([UIImage imageWithCGImage:responseImage], error, nil);
}
}];
#pragma clang diagnostic pop
}
});
}
@@ -401,11 +404,14 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
callbackQueue:dispatch_get_main_queue()
completion:cacheCompletion];
} else {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
[_cache fetchCachedImageWithURL:_URL
callbackQueue:dispatch_get_main_queue()
completion:^(CGImageRef image) {
cacheCompletion([UIImage imageWithCGImage:image]);
}];
#pragma clang diagnostic pop
}
} else {
[self _downloadImageWithCompletion:finished];

View File

@@ -7,7 +7,7 @@
*/
#import <UIKit/UIKit.h>
#import <Foundation/Foundation.h>
#import <AsyncDisplayKit/ASBaseDefines.h>
NS_ASSUME_NONNULL_BEGIN
@@ -115,7 +115,7 @@ withDownloadIdentifier:(id)downloadIdentifier;
- (nullable id)downloadImageWithURL:(NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
downloadProgressBlock:(void (^ _Nullable)(CGFloat progress))downloadProgressBlock
completion:(void (^ _Nullable)(CGImageRef _Nullable image, NSError * _Nullable error))completion;
completion:(void (^ _Nullable)(CGImageRef _Nullable image, NSError * _Nullable error))completion ASDISPLAYNODE_DEPRECATED;
@end
@@ -127,7 +127,7 @@ withDownloadIdentifier:(id)downloadIdentifier;
*/
- (void)fetchCachedImageWithURL:(nullable NSURL *)URL
callbackQueue:(nullable dispatch_queue_t)callbackQueue
completion:(void (^)(CGImageRef _Nullable imageFromCache))completion;
completion:(void (^)(CGImageRef _Nullable imageFromCache))completion ASDISPLAYNODE_DEPRECATED;
@end

View File

@@ -22,7 +22,10 @@
ASBasicImageDownloader *downloader = [ASBasicImageDownloader sharedImageDownloader];
NSURL *URL = [NSURL URLWithString:@"http://wrongPath/wrongResource.png"];
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
__block BOOL firstDone = NO;
[downloader downloadImageWithURL:URL
@@ -40,7 +43,9 @@
completion:^(CGImageRef image, NSError *error) {
secondDone = YES;
}];
#pragma clang diagnostic pop
sleep(3);
XCTAssert(firstDone && secondDone, @"Not all ASBasicImageDownloader completion handlers have been called after 3 seconds");
}