diff --git a/AsyncDisplayKit/ASCollectionView.h b/AsyncDisplayKit/ASCollectionView.h index 3e210ada38..b7e6a42051 100644 --- a/AsyncDisplayKit/ASCollectionView.h +++ b/AsyncDisplayKit/ASCollectionView.h @@ -504,18 +504,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (BOOL)shouldBatchFetchForCollectionView:(ASCollectionView *)collectionView; -/** - * Informs the delegate that the collection view did remove the node which was previously - * at the given index path from the view hierarchy. - * - * @warning AsyncDisplayKit processes collection view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - * - * This method is deprecated. Use @c collectionView:didEndDisplayingNode:forItemAtIndexPath: instead. - */ -- (void)collectionView:(ASCollectionView *)collectionView didEndDisplayingNodeForItemAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED; - /** * Informs the delegate that the collection view will add the node * at the given index path to the view hierarchy. @@ -563,10 +551,4 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface ASCollectionView (Deprecated) - -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout asyncDataFetching:(BOOL)asyncDataFetchingEnabled ASDISPLAYNODE_DEPRECATED; - -@end - NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASCollectionView.mm b/AsyncDisplayKit/ASCollectionView.mm index 3fd493c002..074b2aa9d8 100644 --- a/AsyncDisplayKit/ASCollectionView.mm +++ b/AsyncDisplayKit/ASCollectionView.mm @@ -146,7 +146,6 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; unsigned int asyncDelegateCollectionViewWillDisplayNodeForItemAtIndexPath:1; unsigned int asyncDelegateCollectionViewWillDisplayNodeForItemAtIndexPathDeprecated:1; unsigned int asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPath:1; - unsigned int asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPathDeprecated:1; unsigned int asyncDelegateCollectionViewWillBeginBatchFetchWithContext:1; unsigned int asyncDelegateShouldBatchFetchForCollectionView:1; } _asyncDelegateFlags; @@ -200,12 +199,6 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; return [self _initWithFrame:frame collectionViewLayout:layout ownedByNode:NO]; } -// FIXME: This method is deprecated and will probably be removed in or shortly after 2.0. -- (instancetype)initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout asyncDataFetching:(BOOL)asyncDataFetchingEnabled -{ - return [self _initWithFrame:frame collectionViewLayout:layout ownedByNode:NO]; -} - - (instancetype)_initWithFrame:(CGRect)frame collectionViewLayout:(UICollectionViewLayout *)layout ownedByNode:(BOOL)ownedByNode { return [self _initWithFrame:frame collectionViewLayout:layout layoutFacilitator:nil ownedByNode:ownedByNode]; @@ -393,7 +386,6 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; if (_asyncDelegateFlags.asyncDelegateCollectionViewWillDisplayNodeForItemAtIndexPath == NO) { _asyncDelegateFlags.asyncDelegateCollectionViewWillDisplayNodeForItemAtIndexPathDeprecated = [_asyncDelegate respondsToSelector:@selector(collectionView:willDisplayNodeForItemAtIndexPath:)]; } - _asyncDelegateFlags.asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPathDeprecated = [_asyncDelegate respondsToSelector:@selector(collectionView:didEndDisplayingNodeForItemAtIndexPath:)]; _asyncDelegateFlags.asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPath = [_asyncDelegate respondsToSelector:@selector(collectionView:didEndDisplayingNode:forItemAtIndexPath:)]; _asyncDelegateFlags.asyncDelegateCollectionViewWillBeginBatchFetchWithContext = [_asyncDelegate respondsToSelector:@selector(collectionView:willBeginBatchFetchWithContext:)]; _asyncDelegateFlags.asyncDelegateShouldBatchFetchForCollectionView = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForCollectionView:)]; @@ -719,13 +711,6 @@ static NSString * const kCellReuseIdentifier = @"_ASCollectionViewCell"; [_cellsForVisibilityUpdates removeObject:cell]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (_asyncDelegateFlags.asyncDelegateCollectionViewDidEndDisplayingNodeForItemAtIndexPathDeprecated) { - [_asyncDelegate collectionView:self didEndDisplayingNodeForItemAtIndexPath:indexPath]; - } -#pragma clang diagnostic pop - cellNode.scrollView = nil; } diff --git a/AsyncDisplayKit/ASDisplayNode+Deprecated.h b/AsyncDisplayKit/ASDisplayNode+Deprecated.h index 737116d4dd..e62dd4769b 100644 --- a/AsyncDisplayKit/ASDisplayNode+Deprecated.h +++ b/AsyncDisplayKit/ASDisplayNode+Deprecated.h @@ -104,8 +104,4 @@ */ @property (nonatomic, assign) BOOL usesImplicitHierarchyManagement ASDISPLAYNODE_DEPRECATED; -- (void)reclaimMemory ASDISPLAYNODE_DEPRECATED; -- (void)recursivelyReclaimMemory ASDISPLAYNODE_DEPRECATED; -@property (nonatomic, assign) BOOL placeholderFadesOut ASDISPLAYNODE_DEPRECATED; - @end diff --git a/AsyncDisplayKit/ASDisplayNode.mm b/AsyncDisplayKit/ASDisplayNode.mm index 469e6d6f96..7d12302793 100644 --- a/AsyncDisplayKit/ASDisplayNode.mm +++ b/AsyncDisplayKit/ASDisplayNode.mm @@ -3626,24 +3626,4 @@ static const char *ASDisplayNodeAssociatedNodeKey = "ASAssociatedNode"; self.automaticallyManagesSubnodes = enabled; } -- (void)setPlaceholderFadesOut:(BOOL)placeholderFadesOut -{ - self.placeholderFadeDuration = placeholderFadesOut ? 0.1 : 0.0; -} - -- (BOOL)placeholderFadesOut -{ - return self.placeholderFadeDuration > 0.0; -} - -- (void)reclaimMemory -{ - [self clearContents]; -} - -- (void)recursivelyReclaimMemory -{ - [self recursivelyClearContents]; -} - @end diff --git a/AsyncDisplayKit/ASMultiplexImageNode.mm b/AsyncDisplayKit/ASMultiplexImageNode.mm index fdd66f3b02..612ce6479f 100644 --- a/AsyncDisplayKit/ASMultiplexImageNode.mm +++ b/AsyncDisplayKit/ASMultiplexImageNode.mm @@ -50,8 +50,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent { @private // Core. - id _cache; - id _downloader; + id _cache; + id _downloader; __weak id _delegate; struct { @@ -91,7 +91,7 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent BOOL _downloaderSupportsNewProtocol; BOOL _downloaderImplementsSetProgress; BOOL _downloaderImplementsSetPriority; - BOOL _cacheSupportsNewProtocol; + BOOL _cacheSupportsCachedImage; BOOL _cacheSupportsClearing; } @@ -173,19 +173,19 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent if (!(self = [super init])) return nil; - _cache = (id)cache; - _downloader = (id)downloader; + _cache = (id)cache; + _downloader = (id)downloader; - ASDisplayNodeAssert([downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)] || [downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:)], @"downloader must respond to either downloadImageWithURL:callbackQueue:downloadProgress:completion: or downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:."); + ASDisplayNodeAssert([downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)], @"downloader must respond to either downloadImageWithURL:callbackQueue:downloadProgress:completion:."); _downloaderSupportsNewProtocol = [downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)]; - ASDisplayNodeAssert(cache == nil || [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)] || [cache respondsToSelector:@selector(fetchCachedImageWithURL:callbackQueue:completion:)], @"cacher must respond to either cachedImageWithURL:callbackQueue:completion: or fetchCachedImageWithURL:callbackQueue:completion:"); + ASDisplayNodeAssert(cache == nil || [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)], @"cacher must respond to either cachedImageWithURL:callbackQueue:completion:"); _downloaderImplementsSetProgress = [downloader respondsToSelector:@selector(setProgressImageBlock:callbackQueue:withDownloadIdentifier:)]; _downloaderImplementsSetPriority = [downloader respondsToSelector:@selector(setPriority:withDownloadIdentifier:)]; - _cacheSupportsNewProtocol = [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)]; + _cacheSupportsCachedImage = [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)]; _cacheSupportsClearing = [cache respondsToSelector:@selector(clearFetchedImageFromCacheWithURL:)]; _shouldRenderProgressImages = YES; @@ -785,18 +785,10 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent ASDisplayNodeAssertNotNil(completionBlock, @"completionBlock is required"); if (_cache) { - if (_cacheSupportsNewProtocol) { + if (_cacheSupportsCachedImage) { [_cache cachedImageWithURL:imageURL callbackQueue:dispatch_get_main_queue() completion:^(id imageContainer) { completionBlock([imageContainer asdk_image]); }]; - } 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. @@ -850,26 +842,6 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent if (strongSelf->_delegateFlags.downloadFinish) [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 - completion:^(CGImageRef coreGraphicsImage, NSError *error) { - // We dereference iVars directly, so we can't have weakSelf going nil on us. - __typeof__(self) strongSelf = weakSelf; - if (!strongSelf) - return; - - UIImage *downloadedImage = (coreGraphicsImage ? [UIImage imageWithCGImage:coreGraphicsImage] : nil); - completionBlock(downloadedImage, error); - - // Delegateify. - if (strongSelf->_delegateFlags.downloadFinish) - [strongSelf->_delegate multiplexImageNode:weakSelf didFinishDownloadingImageWithIdentifier:imageIdentifier error:error]; - }]]; -#pragma clang diagnostic pop } [self _updateProgressImageBlockOnDownloaderIfNeeded]; }); diff --git a/AsyncDisplayKit/ASNetworkImageNode.mm b/AsyncDisplayKit/ASNetworkImageNode.mm index 8dc9338edf..ee2fa3e2d5 100755 --- a/AsyncDisplayKit/ASNetworkImageNode.mm +++ b/AsyncDisplayKit/ASNetworkImageNode.mm @@ -27,8 +27,8 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; @interface ASNetworkImageNode () { - __weak id _cache; - __weak id _downloader; + __weak id _cache; + __weak id _downloader; // Only access any of these with __instanceLock__. __weak id _delegate; @@ -60,7 +60,7 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; } _downloaderFlags; struct { - unsigned int cacheSupportsNewProtocol:1; + unsigned int cacheSupportsCachedImage:1; unsigned int cacheSupportsClearing:1; unsigned int cacheSupportsSynchronousFetch:1; } _cacheFlags; @@ -74,20 +74,20 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; if (!(self = [super init])) return nil; - _cache = (id)cache; - _downloader = (id)downloader; + _cache = (id)cache; + _downloader = (id)downloader; - ASDisplayNodeAssert([downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)] || [downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:)], @"downloader must respond to either downloadImageWithURL:callbackQueue:downloadProgress:completion: or downloadImageWithURL:callbackQueue:downloadProgressBlock:completion:."); + ASDisplayNodeAssert([downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)], @"downloader must respond to either downloadImageWithURL:callbackQueue:downloadProgress:completion:."); _downloaderFlags.downloaderSupportsNewProtocol = [downloader respondsToSelector:@selector(downloadImageWithURL:callbackQueue:downloadProgress:completion:)]; - ASDisplayNodeAssert(cache == nil || [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)] || [cache respondsToSelector:@selector(fetchCachedImageWithURL:callbackQueue:completion:)], @"cacher must respond to either cachedImageWithURL:callbackQueue:completion: or fetchCachedImageWithURL:callbackQueue:completion:"); + ASDisplayNodeAssert(cache == nil || [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)], @"cacher must respond to either cachedImageWithURL:callbackQueue:completion:"); _downloaderFlags.downloaderImplementsSetProgress = [downloader respondsToSelector:@selector(setProgressImageBlock:callbackQueue:withDownloadIdentifier:)]; _downloaderFlags.downloaderImplementsSetPriority = [downloader respondsToSelector:@selector(setPriority:withDownloadIdentifier:)]; _downloaderFlags.downloaderImplementsAnimatedImage = [downloader respondsToSelector:@selector(animatedImageWithData:)]; - _cacheFlags.cacheSupportsNewProtocol = [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)]; + _cacheFlags.cacheSupportsCachedImage = [cache respondsToSelector:@selector(cachedImageWithURL:callbackQueue:completion:)]; _cacheFlags.cacheSupportsClearing = [cache respondsToSelector:@selector(clearFetchedImageFromCacheWithURL:)]; _cacheFlags.cacheSupportsSynchronousFetch = [cache respondsToSelector:@selector(synchronouslyFetchedCachedImageWithURL:)]; @@ -421,18 +421,6 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; finished(imageContainer, error, downloadIdentifier); } }]; - } else { -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - _downloadIdentifier = [_downloader downloadImageWithURL:_URL - callbackQueue:dispatch_get_main_queue() - downloadProgressBlock:NULL - completion:^(CGImageRef responseImage, NSError *error) { - if (finished != NULL) { - finished([UIImage imageWithCGImage:responseImage], error, nil); - } - }]; -#pragma clang diagnostic pop } [self _updateProgressImageBlockOnDownloaderIfNeeded]; @@ -561,19 +549,10 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0}; } }; - if (_cacheFlags.cacheSupportsNewProtocol) { + if (_cacheFlags.cacheSupportsCachedImage) { [_cache cachedImageWithURL:_URL 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]; diff --git a/AsyncDisplayKit/ASTableView.h b/AsyncDisplayKit/ASTableView.h index b48bccf59d..5e97c74470 100644 --- a/AsyncDisplayKit/ASTableView.h +++ b/AsyncDisplayKit/ASTableView.h @@ -450,18 +450,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (ASSizeRange)tableView:(ASTableView *)tableView constrainedSizeForRowAtIndexPath:(NSIndexPath *)indexPath; -/** - * Informs the delegate that the table view did remove the node which was previously - * at the given index path from the view hierarchy. - * - * @warning AsyncDisplayKit processes table view edits asynchronously. The index path - * passed into this method may not correspond to the same item in your data source - * if your data source has been updated since the last edit was processed. - * - * This method is deprecated. Use @c tableView:didEndDisplayingNode:forRowAtIndexPath: instead. - */ -- (void)tableView:(ASTableView *)tableView didEndDisplayingNodeForRowAtIndexPath:(NSIndexPath *)indexPath ASDISPLAYNODE_DEPRECATED; - /** * Informs the delegate that the table view will add the node * at the given index path to the view hierarchy. @@ -482,10 +470,4 @@ NS_ASSUME_NONNULL_BEGIN @protocol ASTableViewDelegate @end -@interface ASTableView (Deprecated) - -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncDataFetching:(BOOL)asyncDataFetchingEnabled ASDISPLAYNODE_DEPRECATED; - -@end - NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKit/ASTableView.mm b/AsyncDisplayKit/ASTableView.mm index 6197d43651..e2eeafb2e5 100644 --- a/AsyncDisplayKit/ASTableView.mm +++ b/AsyncDisplayKit/ASTableView.mm @@ -136,7 +136,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; unsigned int asyncDelegateTableViewWillDisplayNodeForRowAtIndexPath:1; unsigned int asyncDelegateTableViewWillDisplayNodeForRowAtIndexPathDeprecated:1; unsigned int asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPath:1; - unsigned int asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPathDeprecated:1; unsigned int asyncDelegateScrollViewWillEndDraggingWithVelocityTargetContentOffset:1; unsigned int asyncDelegateTableViewWillBeginBatchFetchWithContext:1; unsigned int asyncDelegateShouldBatchFetchForTableView:1; @@ -221,12 +220,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; return [self _initWithFrame:frame style:style dataControllerClass:nil ownedByNode:NO]; } -// FIXME: This method is deprecated and will probably be removed in or shortly after 2.0. -- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncDataFetching:(BOOL)asyncDataFetchingEnabled -{ - return [self _initWithFrame:frame style:style dataControllerClass:nil ownedByNode:NO]; -} - - (instancetype)_initWithFrame:(CGRect)frame style:(UITableViewStyle)style dataControllerClass:(Class)dataControllerClass ownedByNode:(BOOL)ownedByNode { if (!(self = [super initWithFrame:frame style:style])) { @@ -337,7 +330,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; _asyncDelegateFlags.asyncDelegateTableViewWillDisplayNodeForRowAtIndexPathDeprecated = [_asyncDelegate respondsToSelector:@selector(tableView:willDisplayNodeForRowAtIndexPath:)]; } _asyncDelegateFlags.asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPath = [_asyncDelegate respondsToSelector:@selector(tableView:didEndDisplayingNode:forRowAtIndexPath:)]; - _asyncDelegateFlags.asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPathDeprecated = [_asyncDelegate respondsToSelector:@selector(tableView:didEndDisplayingNodeForRowAtIndexPath:)]; _asyncDelegateFlags.asyncDelegateScrollViewWillEndDraggingWithVelocityTargetContentOffset = [_asyncDelegate respondsToSelector:@selector(scrollViewWillEndDragging:withVelocity:targetContentOffset:)]; _asyncDelegateFlags.asyncDelegateTableViewWillBeginBatchFetchWithContext = [_asyncDelegate respondsToSelector:@selector(tableView:willBeginBatchFetchWithContext:)]; _asyncDelegateFlags.asyncDelegateShouldBatchFetchForTableView = [_asyncDelegate respondsToSelector:@selector(shouldBatchFetchForTableView:)]; @@ -727,13 +719,6 @@ static NSString * const kCellReuseIdentifier = @"_ASTableViewCell"; } [_cellsForVisibilityUpdates removeObject:cell]; - -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - if (_asyncDelegateFlags.asyncDelegateTableViewDidEndDisplayingNodeForRowAtIndexPathDeprecated) { - [_asyncDelegate tableView:self didEndDisplayingNodeForRowAtIndexPath:indexPath]; - } -#pragma clang diagnostic pop cellNode.scrollView = nil; } diff --git a/AsyncDisplayKit/ASVideoNode.h b/AsyncDisplayKit/ASVideoNode.h index 9223da3fd4..9a7d6f9417 100644 --- a/AsyncDisplayKit/ASVideoNode.h +++ b/AsyncDisplayKit/ASVideoNode.h @@ -142,11 +142,6 @@ NS_ASSUME_NONNULL_BEGIN */ - (void)videoNodeDidRecoverFromStall:(ASVideoNode *)videoNode; -// Below are deprecated methods. To be removed in ASDK 2.0 release -- (void)videoPlaybackDidFinish:(ASVideoNode *)videoNode __deprecated; -- (void)videoNodeWasTapped:(ASVideoNode *)videoNode __deprecated; -- (void)videoNode:(ASVideoNode *)videoNode didPlayToSecond:(NSTimeInterval)second __deprecated; - @end @interface ASVideoNode (Unavailable) diff --git a/AsyncDisplayKit/ASVideoNode.mm b/AsyncDisplayKit/ASVideoNode.mm index a3810a12fd..36fb9b2ce6 100644 --- a/AsyncDisplayKit/ASVideoNode.mm +++ b/AsyncDisplayKit/ASVideoNode.mm @@ -362,12 +362,6 @@ static NSString * const kRate = @"rate"; if (_delegateFlags.delegateDidTapVideoNode) { [_delegate didTapVideoNode:self]; - } else if (_delegateFlags.delegateVideoNodeWasTapped_deprecated) { - // TODO: This method is deprecated, remove in ASDK 2.0 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_delegate videoNodeWasTapped:self]; -#pragma clang diagnostic pop } else { if (_shouldBePlaying) { [self pause]; @@ -414,12 +408,6 @@ static NSString * const kRate = @"rate"; if (_delegateFlags.delegateVideoNodeDidPlayToTimeInterval) { [_delegate videoNode:self didPlayToTimeInterval:timeInSeconds]; - } else if (_delegateFlags.delegateVideoNodeDidPlayToSecond_deprecated) { - // TODO: This method is deprecated, remove in ASDK 2.0 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_delegate videoNode:self didPlayToSecond:timeInSeconds]; -#pragma clang diagnostic pop } } @@ -591,14 +579,6 @@ static NSString * const kRate = @"rate"; _delegateFlags.delegateVideoNodeDidSetCurrentItem = [_delegate respondsToSelector:@selector(videoNode:didSetCurrentItem:)]; _delegateFlags.delegateVideoNodeDidStallAtTimeInterval = [_delegate respondsToSelector:@selector(videoNode:didStallAtTimeInterval:)]; _delegateFlags.delegateVideoNodeDidRecoverFromStall = [_delegate respondsToSelector:@selector(videoNodeDidRecoverFromStall:)]; - - // deprecated methods - _delegateFlags.delegateVideoPlaybackDidFinish_deprecated = [_delegate respondsToSelector:@selector(videoPlaybackDidFinish:)]; - _delegateFlags.delegateVideoNodeDidPlayToSecond_deprecated = [_delegate respondsToSelector:@selector(videoNode:didPlayToSecond:)]; - _delegateFlags.delegateVideoNodeWasTapped_deprecated = [_delegate respondsToSelector:@selector(videoNodeWasTapped:)]; - ASDisplayNodeAssert((_delegateFlags.delegateVideoDidPlayToEnd && _delegateFlags.delegateVideoPlaybackDidFinish_deprecated) == NO, @"Implemented both deprecated and non-deprecated methods - please remove videoPlaybackDidFinish, it's deprecated"); - ASDisplayNodeAssert((_delegateFlags.delegateVideoNodeDidPlayToTimeInterval && _delegateFlags.delegateVideoNodeDidPlayToSecond_deprecated) == NO, @"Implemented both deprecated and non-deprecated methods - please remove videoNodeWasTapped, it's deprecated"); - ASDisplayNodeAssert((_delegateFlags.delegateDidTapVideoNode && _delegateFlags.delegateVideoNodeWasTapped_deprecated) == NO, @"Implemented both deprecated and non-deprecated methods - please remove didPlayToSecond, it's deprecated"); } } @@ -700,12 +680,6 @@ static NSString * const kRate = @"rate"; self.playerState = ASVideoNodePlayerStateFinished; if (_delegateFlags.delegateVideoDidPlayToEnd) { [_delegate videoDidPlayToEnd:self]; - } else if (_delegateFlags.delegateVideoPlaybackDidFinish_deprecated) { - // TODO: This method is deprecated, remove in ASDK 2.0 -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" - [_delegate videoPlaybackDidFinish:self]; -#pragma clang diagnostic pop } if (_shouldAutorepeat) { diff --git a/AsyncDisplayKit/Details/ASBasicImageDownloader.h b/AsyncDisplayKit/Details/ASBasicImageDownloader.h index 147a7a85ab..3472cab108 100644 --- a/AsyncDisplayKit/Details/ASBasicImageDownloader.h +++ b/AsyncDisplayKit/Details/ASBasicImageDownloader.h @@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN /** * @abstract Simple NSURLSession-based image downloader. */ -@interface ASBasicImageDownloader : NSObject +@interface ASBasicImageDownloader : NSObject + (instancetype)sharedImageDownloader; diff --git a/AsyncDisplayKit/Details/ASBasicImageDownloader.mm b/AsyncDisplayKit/Details/ASBasicImageDownloader.mm index bf84475b88..16a9ee4b8d 100644 --- a/AsyncDisplayKit/Details/ASBasicImageDownloader.mm +++ b/AsyncDisplayKit/Details/ASBasicImageDownloader.mm @@ -13,6 +13,7 @@ #import #import "ASBasicImageDownloaderInternal.h" +#import "ASImageContainerProtocolCategories.h" #import "ASThread.h" @@ -21,9 +22,6 @@ * Collection of properties associated with a download request. */ -typedef void (^ASBasicImageDownloaderContextProgressBlock)(CGFloat); -typedef void (^ASBasicImageDownloaderContextCompletionBlock)(CGImageRef, NSError *); - NSString * const kASBasicImageDownloaderContextCallbackQueue = @"kASBasicImageDownloaderContextCallbackQueue"; NSString * const kASBasicImageDownloaderContextProgressBlock = @"kASBasicImageDownloaderContextProgressBlock"; NSString * const kASBasicImageDownloaderContextCompletionBlock = @"kASBasicImageDownloaderContextCompletionBlock"; @@ -104,7 +102,7 @@ static ASDN::RecursiveMutex currentRequestsLock; { ASDN::MutexLocker l(__instanceLock__); for (NSDictionary *callbackData in self.callbackDatas) { - ASBasicImageDownloaderContextProgressBlock progressBlock = callbackData[kASBasicImageDownloaderContextProgressBlock]; + ASImageDownloaderProgress progressBlock = callbackData[kASBasicImageDownloaderContextProgressBlock]; dispatch_queue_t callbackQueue = callbackData[kASBasicImageDownloaderContextCallbackQueue]; if (progressBlock) { @@ -119,12 +117,12 @@ static ASDN::RecursiveMutex currentRequestsLock; { ASDN::MutexLocker l(__instanceLock__); for (NSDictionary *callbackData in self.callbackDatas) { - ASBasicImageDownloaderContextCompletionBlock completionBlock = callbackData[kASBasicImageDownloaderContextCompletionBlock]; + ASImageDownloaderCompletion completionBlock = callbackData[kASBasicImageDownloaderContextCompletionBlock]; dispatch_queue_t callbackQueue = callbackData[kASBasicImageDownloaderContextCallbackQueue]; if (completionBlock) { dispatch_async(callbackQueue, ^{ - completionBlock(image.CGImage, error); + completionBlock(image, error, nil); }); } } @@ -229,9 +227,9 @@ static const char *kContextKey = NSStringFromClass(ASBasicImageDownloaderContext #pragma mark ASImageDownloaderProtocol. - (id)downloadImageWithURL:(NSURL *)URL - callbackQueue:(dispatch_queue_t)callbackQueue - downloadProgressBlock:(void (^)(CGFloat))downloadProgressBlock - completion:(void (^)(CGImageRef, NSError *))completion + callbackQueue:(dispatch_queue_t)callbackQueue + downloadProgress:(nullable ASImageDownloaderProgress)downloadProgress + completion:(ASImageDownloaderCompletion)completion { ASBasicImageDownloaderContext *context = [ASBasicImageDownloaderContext contextForURL:URL]; @@ -242,8 +240,8 @@ static const char *kContextKey = NSStringFromClass(ASBasicImageDownloaderContext NSMutableDictionary *callbackData = [NSMutableDictionary dictionary]; callbackData[kASBasicImageDownloaderContextCallbackQueue] = callbackQueue ? : dispatch_get_main_queue(); - if (downloadProgressBlock) { - callbackData[kASBasicImageDownloaderContextProgressBlock] = [downloadProgressBlock copy]; + if (downloadProgress) { + callbackData[kASBasicImageDownloaderContextProgressBlock] = [downloadProgress copy]; } if (completion) { diff --git a/AsyncDisplayKit/Details/ASImageProtocols.h b/AsyncDisplayKit/Details/ASImageProtocols.h index e9074e723b..721f8faeea 100644 --- a/AsyncDisplayKit/Details/ASImageProtocols.h +++ b/AsyncDisplayKit/Details/ASImageProtocols.h @@ -213,29 +213,4 @@ withDownloadIdentifier:(id)downloadIdentifier; @end -@protocol ASImageDownloaderProtocolDeprecated - -@optional -/** - @deprecated This method is deprecated @see downloadImageWithURL:callbackQueue:downloadProgress:completion: instead - */ -- (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 ASDISPLAYNODE_DEPRECATED; - -@end - -@protocol ASImageCacheProtocolDeprecated - -@optional -/** - @deprecated This method is deprecated @see cachedImageWithURL:callbackQueue:completion: instead - */ -- (void)fetchCachedImageWithURL:(nullable NSURL *)URL - callbackQueue:(nullable dispatch_queue_t)callbackQueue - completion:(void (^)(CGImageRef _Nullable imageFromCache))completion ASDISPLAYNODE_DEPRECATED; - -@end - NS_ASSUME_NONNULL_END diff --git a/AsyncDisplayKitTests/ASBasicImageDownloaderTests.m b/AsyncDisplayKitTests/ASBasicImageDownloaderTests.m index bc8972557b..c4d05244ca 100644 --- a/AsyncDisplayKitTests/ASBasicImageDownloaderTests.m +++ b/AsyncDisplayKitTests/ASBasicImageDownloaderTests.m @@ -28,22 +28,19 @@ ASBasicImageDownloader *downloader = [ASBasicImageDownloader sharedImageDownloader]; NSURL *URL = [NSURL URLWithString:@"http://wrongPath/wrongResource.png"]; -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wdeprecated-declarations" [downloader downloadImageWithURL:URL callbackQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - downloadProgressBlock:nil - completion:^(CGImageRef image, NSError *error) { + downloadProgress:nil + completion:^(id _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier) { [firstExpectation fulfill]; }]; - + [downloader downloadImageWithURL:URL callbackQueue:dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0) - downloadProgressBlock:nil - completion:^(CGImageRef image, NSError *error) { + downloadProgress:nil + completion:^(id _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier) { [secondExpectation fulfill]; }]; -#pragma clang diagnostic pop [self waitForExpectationsWithTimeout:30 handler:nil]; } diff --git a/examples/Kittens/Sample/ViewController.m b/examples/Kittens/Sample/ViewController.m index 51f3807015..b4f0ad01b0 100644 --- a/examples/Kittens/Sample/ViewController.m +++ b/examples/Kittens/Sample/ViewController.m @@ -55,7 +55,7 @@ static const NSInteger kMaxLitterSize = 100; // max number of kitten cell if (!(self = [super init])) return nil; - _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain asyncDataFetching:YES]; + _tableView = [[ASTableView alloc] initWithFrame:CGRectZero style:UITableViewStylePlain]; _tableView.separatorStyle = UITableViewCellSeparatorStyleNone; // KittenNode has its own separator _tableView.asyncDataSource = self; _tableView.asyncDelegate = self;