-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for providing additional info to network image node deleg…
…ate (#775) * Add support for piping arbitrary user info from ASImageDownloader to the ASNetworkImageNodeDelegate * s/source/sourceType * Fix stuff and take Michael's advice
- Loading branch information
1 parent
30aac78
commit ec4ce2a
Showing
17 changed files
with
173 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// | ||
// ASNetworkImageLoadInfo.h | ||
// AsyncDisplayKit | ||
// | ||
// Created by Adlai on 1/30/18. | ||
// Copyright © 2018 Facebook. All rights reserved. | ||
// | ||
|
||
#import <Foundation/Foundation.h> | ||
#import <AsyncDisplayKit/ASBaseDefines.h> | ||
|
||
NS_ASSUME_NONNULL_BEGIN | ||
|
||
typedef NS_ENUM(NSInteger, ASNetworkImageSourceType) { | ||
ASNetworkImageSourceUnspecified = 0, | ||
ASNetworkImageSourceSynchronousCache, | ||
ASNetworkImageSourceAsynchronousCache, | ||
ASNetworkImageSourceFileURL, | ||
ASNetworkImageSourceDownload, | ||
}; | ||
|
||
AS_SUBCLASSING_RESTRICTED | ||
@interface ASNetworkImageLoadInfo : NSObject <NSCopying> | ||
|
||
/// The type of source from which the image was loaded. | ||
@property (readonly) ASNetworkImageSourceType sourceType; | ||
|
||
/// The image URL that was downloaded. | ||
@property (readonly) NSURL *url; | ||
|
||
/// The download identifier, if one was provided. | ||
@property (nullable, readonly) id downloadIdentifier; | ||
|
||
/// The userInfo object provided by the downloader, if one was provided. | ||
@property (nullable, readonly) id userInfo; | ||
|
||
@end | ||
|
||
NS_ASSUME_NONNULL_END |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
// | ||
// ASNetworkImageLoadInfo.m | ||
// AsyncDisplayKit | ||
// | ||
// Created by Adlai on 1/30/18. | ||
// Copyright © 2018 Facebook. All rights reserved. | ||
// | ||
|
||
#import <AsyncDisplayKit/ASNetworkImageLoadInfo.h> | ||
#import <AsyncDisplayKit/ASNetworkImageLoadInfo+Private.h> | ||
|
||
@implementation ASNetworkImageLoadInfo | ||
|
||
- (instancetype)initWithURL:(NSURL *)url sourceType:(ASNetworkImageSourceType)sourceType downloadIdentifier:(id)downloadIdentifier userInfo:(id)userInfo | ||
{ | ||
if (self = [super init]) { | ||
_url = [url copy]; | ||
_sourceType = sourceType; | ||
_downloadIdentifier = downloadIdentifier; | ||
_userInfo = userInfo; | ||
} | ||
return self; | ||
} | ||
|
||
#pragma mark - NSCopying | ||
|
||
- (id)copyWithZone:(NSZone *)zone | ||
{ | ||
return self; | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.