mirror of
https://github.com/HackPlan/AsyncDisplayKit.git
synced 2026-03-28 23:58:50 +08:00
[API] Remove old deprecated methods. (#2312)
* Remove old deprecated methods. Will restore ones that were removed recently based on PR. * Update example to use non-deprecated method. * Don't remove locking / unlocking, insets or willDisplayNode deprecated methods yet.
This commit is contained in:
committed by
Hannah Trosi
parent
97832ce3aa
commit
79fa476644
@@ -499,18 +499,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.
|
||||
@@ -558,10 +546,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
|
||||
|
||||
@@ -159,7 +159,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;
|
||||
@@ -212,12 +211,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];
|
||||
@@ -404,7 +397,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:)];
|
||||
@@ -724,13 +716,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;
|
||||
}
|
||||
|
||||
|
||||
@@ -72,8 +72,4 @@
|
||||
*/
|
||||
@property (nonatomic, assign) BOOL usesImplicitHierarchyManagement ASDISPLAYNODE_DEPRECATED;
|
||||
|
||||
- (void)reclaimMemory ASDISPLAYNODE_DEPRECATED;
|
||||
- (void)recursivelyReclaimMemory ASDISPLAYNODE_DEPRECATED;
|
||||
@property (nonatomic, assign) BOOL placeholderFadesOut ASDISPLAYNODE_DEPRECATED;
|
||||
|
||||
@end
|
||||
|
||||
@@ -3514,24 +3514,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
|
||||
|
||||
@@ -50,8 +50,8 @@ typedef void(^ASMultiplexImageLoadCompletionBlock)(UIImage *image, id imageIdent
|
||||
{
|
||||
@private
|
||||
// Core.
|
||||
id<ASImageCacheProtocol, ASImageCacheProtocolDeprecated> _cache;
|
||||
id<ASImageDownloaderProtocol, ASImageDownloaderProtocolDeprecated> _downloader;
|
||||
id<ASImageCacheProtocol> _cache;
|
||||
id<ASImageDownloaderProtocol> _downloader;
|
||||
|
||||
__weak id<ASMultiplexImageNodeDelegate> _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<ASImageCacheProtocol, ASImageCacheProtocolDeprecated>)cache;
|
||||
_downloader = (id<ASImageDownloaderProtocol, ASImageDownloaderProtocolDeprecated>)downloader;
|
||||
_cache = (id<ASImageCacheProtocol>)cache;
|
||||
_downloader = (id<ASImageDownloaderProtocol>)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 <ASImageContainerProtocol> 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];
|
||||
});
|
||||
|
||||
@@ -27,8 +27,8 @@ static const CGSize kMinReleaseImageOnBackgroundSize = {20.0, 20.0};
|
||||
|
||||
@interface ASNetworkImageNode ()
|
||||
{
|
||||
__weak id<ASImageCacheProtocol, ASImageCacheProtocolDeprecated> _cache;
|
||||
__weak id<ASImageDownloaderProtocol, ASImageDownloaderProtocolDeprecated> _downloader;
|
||||
__weak id<ASImageCacheProtocol> _cache;
|
||||
__weak id<ASImageDownloaderProtocol> _downloader;
|
||||
|
||||
// Only access any of these with __instanceLock__.
|
||||
__weak id<ASNetworkImageNodeDelegate> _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<ASImageCacheProtocol, ASImageCacheProtocolDeprecated>)cache;
|
||||
_downloader = (id<ASImageDownloaderProtocol, ASImageDownloaderProtocolDeprecated>)downloader;
|
||||
_cache = (id<ASImageCacheProtocol>)cache;
|
||||
_downloader = (id<ASImageDownloaderProtocol>)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];
|
||||
|
||||
@@ -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 <ASTableDelegate>
|
||||
@end
|
||||
|
||||
@interface ASTableView (Deprecated)
|
||||
|
||||
- (instancetype)initWithFrame:(CGRect)frame style:(UITableViewStyle)style asyncDataFetching:(BOOL)asyncDataFetchingEnabled ASDISPLAYNODE_DEPRECATED;
|
||||
|
||||
@end
|
||||
|
||||
NS_ASSUME_NONNULL_END
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -365,12 +365,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];
|
||||
@@ -417,12 +411,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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -594,14 +582,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");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -703,12 +683,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) {
|
||||
|
||||
@@ -15,7 +15,7 @@ NS_ASSUME_NONNULL_BEGIN
|
||||
/**
|
||||
* @abstract Simple NSURLSession-based image downloader.
|
||||
*/
|
||||
@interface ASBasicImageDownloader : NSObject <ASImageDownloaderProtocolDeprecated, ASImageDownloaderProtocol>
|
||||
@interface ASBasicImageDownloader : NSObject <ASImageDownloaderProtocol>
|
||||
|
||||
+ (instancetype)sharedImageDownloader;
|
||||
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
#import <objc/runtime.h>
|
||||
|
||||
#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) {
|
||||
|
||||
@@ -213,29 +213,4 @@ withDownloadIdentifier:(id)downloadIdentifier;
|
||||
|
||||
@end
|
||||
|
||||
@protocol ASImageDownloaderProtocolDeprecated <ASImageDownloaderProtocol>
|
||||
|
||||
@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 <ASImageCacheProtocol>
|
||||
|
||||
@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
|
||||
|
||||
@@ -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<ASImageContainerProtocol> _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<ASImageContainerProtocol> _Nullable image, NSError * _Nullable error, id _Nullable downloadIdentifier) {
|
||||
[secondExpectation fulfill];
|
||||
}];
|
||||
#pragma clang diagnostic pop
|
||||
|
||||
[self waitForExpectationsWithTimeout:30 handler:nil];
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user