Have ASNetworkImageNode report whether images were cached or not (#639)

* Have ASNetworkImageNode report whether images were cached or not.

* Update changelog

* Add fileURL case
This commit is contained in:
Adlai Holler
2017-10-25 15:57:30 -07:00
committed by GitHub
parent 8317c11e42
commit af99ff5ef2
4 changed files with 119 additions and 58 deletions

View File

@@ -130,6 +130,21 @@ 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.
@@ -137,6 +152,18 @@ NS_ASSUME_NONNULL_BEGIN
@protocol ASNetworkImageNodeDelegate <NSObject>
@optional
/**
* Notification that the image node finished downloading an image, with additional info.
* If implemented, this method will be called instead of `imageNode:didLoadImage:`.
*
* @param imageNode The sender.
* @param image The newly-loaded image.
* @param info Misc information about the image load.
*
* @discussion Called on a background queue.
*/
- (void)imageNode:(ASNetworkImageNode *)imageNode didLoadImage:(UIImage *)image info:(ASNetworkImageNodeDidLoadInfo)info;
/**
* Notification that the image node finished downloading an image.
*