mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 14:20:20 +00:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user