Add support for providing additional info to network image node delegate (#775)

* Add support for piping arbitrary user info from ASImageDownloader to the ASNetworkImageNodeDelegate

* s/source/sourceType

* Fix stuff and take Michael's advice
This commit is contained in:
Adlai Holler
2018-01-30 17:50:38 -05:00
committed by GitHub
parent 196d76d82d
commit fef965f78e
17 changed files with 173 additions and 55 deletions

View File

@@ -20,6 +20,7 @@
NS_ASSUME_NONNULL_BEGIN
@protocol ASNetworkImageNodeDelegate, ASImageCacheProtocol, ASImageDownloaderProtocol;
@class ASNetworkImageLoadInfo;
/**
@@ -134,20 +135,6 @@ NS_ASSUME_NONNULL_BEGIN
#pragma mark -
typedef NS_ENUM(NSInteger, ASNetworkImageSource) {
ASNetworkImageSourceUnspecified = 0,
ASNetworkImageSourceSynchronousCache,
ASNetworkImageSourceAsynchronousCache,
ASNetworkImageSourceFileURL,
ASNetworkImageSourceDownload,
};
/// A struct that carries details about ASNetworkImageNode's image loads.
typedef struct {
/// The source from which the image was loaded.
ASNetworkImageSource imageSource;
} ASNetworkImageNodeDidLoadInfo;
/**
* The methods declared by the ASNetworkImageNodeDelegate protocol allow the adopting delegate to respond to
* notifications such as finished decoding and downloading an image.
@@ -161,11 +148,11 @@ typedef struct {
*
* @param imageNode The sender.
* @param image The newly-loaded image.
* @param info Misc information about the image load.
* @param info Additional information about the image load.
*
* @discussion Called on a background queue.
*/
- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageNodeDidLoadInfo)info;
- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageLoadInfo *)info;
/**
* Notification that the image node finished downloading an image.