...
|
...
|
@@ -14,25 +14,9 @@ |
|
|
#import "YHLog.h"
|
|
|
#import "YHEventReport.h"
|
|
|
|
|
|
static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock;
|
|
|
|
|
|
@interface SDWebImageManager()
|
|
|
|
|
|
@property (nonatomic, copy) SDWebImageCompletionWithFinishedBlock actionHandlerBlock;
|
|
|
|
|
|
@end
|
|
|
|
|
|
@implementation SDWebImageManager (AutoTrack)
|
|
|
|
|
|
#pragma mark - 属性
|
|
|
|
|
|
- (SDWebImageCompletionWithFinishedBlock)actionHandlerBlock{
|
|
|
return objc_getAssociatedObject(self, @selector(actionHandlerBlock));
|
|
|
}
|
|
|
|
|
|
- (void)setActionHandlerBlock:(SDWebImageCompletionWithFinishedBlock)actionHandlerBlock{
|
|
|
objc_setAssociatedObject(self, @selector(actionHandlerBlock), actionHandlerBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
|
}
|
|
|
|
|
|
- (void)setYh_webImageId:(NSString *)yh_webImageId{
|
|
|
objc_setAssociatedObject(self,@selector(yh_webImageId),yh_webImageId,OBJC_ASSOCIATION_RETAIN);
|
...
|
...
|
@@ -67,7 +51,6 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
|
|
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
|
|
completed:(SDWebImageCompletionWithFinishedBlock)completedBlock
|
|
|
{
|
|
|
objc_setAssociatedObject(self, yher_actionHandlerBlock, completedBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
|
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isImagePerformanceTrackEnable){
|
|
|
[[YH_EventCollector sharedInstance] timeEventStartWithWebImageDownload:self];
|
...
|
...
|
@@ -85,9 +68,8 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
|
|
}
|
|
|
}
|
|
|
|
|
|
SDWebImageCompletionWithFinishedBlock actionHandlerBlock = objc_getAssociatedObject(self, yher_actionHandlerBlock);
|
|
|
if (actionHandlerBlock) {
|
|
|
actionHandlerBlock(image,error,cacheType,finished,imageURL);
|
|
|
if (completedBlock) {
|
|
|
completedBlock(image,error,cacheType,finished,imageURL);
|
|
|
}
|
|
|
}];
|
|
|
}
|
...
|
...
|
|