|
@@ -14,25 +14,9 @@ |
|
@@ -14,25 +14,9 @@ |
14
|
#import "YHLog.h"
|
14
|
#import "YHLog.h"
|
15
|
#import "YHEventReport.h"
|
15
|
#import "YHEventReport.h"
|
16
|
|
16
|
|
17
|
-static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock;
|
|
|
18
|
-
|
|
|
19
|
-@interface SDWebImageManager()
|
|
|
20
|
-
|
|
|
21
|
-@property (nonatomic, copy) SDWebImageCompletionWithFinishedBlock actionHandlerBlock;
|
|
|
22
|
-
|
|
|
23
|
-@end
|
|
|
24
|
|
17
|
|
25
|
@implementation SDWebImageManager (AutoTrack)
|
18
|
@implementation SDWebImageManager (AutoTrack)
|
26
|
|
19
|
|
27
|
-#pragma mark - 属性
|
|
|
28
|
-
|
|
|
29
|
-- (SDWebImageCompletionWithFinishedBlock)actionHandlerBlock{
|
|
|
30
|
- return objc_getAssociatedObject(self, @selector(actionHandlerBlock));
|
|
|
31
|
-}
|
|
|
32
|
-
|
|
|
33
|
-- (void)setActionHandlerBlock:(SDWebImageCompletionWithFinishedBlock)actionHandlerBlock{
|
|
|
34
|
- objc_setAssociatedObject(self, @selector(actionHandlerBlock), actionHandlerBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
|
35
|
-}
|
|
|
36
|
|
20
|
|
37
|
- (void)setYh_webImageId:(NSString *)yh_webImageId{
|
21
|
- (void)setYh_webImageId:(NSString *)yh_webImageId{
|
38
|
objc_setAssociatedObject(self,@selector(yh_webImageId),yh_webImageId,OBJC_ASSOCIATION_RETAIN);
|
22
|
objc_setAssociatedObject(self,@selector(yh_webImageId),yh_webImageId,OBJC_ASSOCIATION_RETAIN);
|
|
@@ -67,7 +51,6 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
|
@@ -67,7 +51,6 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
67
|
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
51
|
progress:(SDWebImageDownloaderProgressBlock)progressBlock
|
68
|
completed:(SDWebImageCompletionWithFinishedBlock)completedBlock
|
52
|
completed:(SDWebImageCompletionWithFinishedBlock)completedBlock
|
69
|
{
|
53
|
{
|
70
|
- objc_setAssociatedObject(self, yher_actionHandlerBlock, completedBlock, OBJC_ASSOCIATION_COPY_NONATOMIC);
|
|
|
71
|
|
54
|
|
72
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isImagePerformanceTrackEnable){
|
55
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].isImagePerformanceTrackEnable){
|
73
|
[[YH_EventCollector sharedInstance] timeEventStartWithWebImageDownload:self];
|
56
|
[[YH_EventCollector sharedInstance] timeEventStartWithWebImageDownload:self];
|
|
@@ -85,9 +68,8 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
|
@@ -85,9 +68,8 @@ static const void *yher_actionHandlerBlock = &yher_actionHandlerBlock; |
85
|
}
|
68
|
}
|
86
|
}
|
69
|
}
|
87
|
|
70
|
|
88
|
- SDWebImageCompletionWithFinishedBlock actionHandlerBlock = objc_getAssociatedObject(self, yher_actionHandlerBlock);
|
|
|
89
|
- if (actionHandlerBlock) {
|
|
|
90
|
- actionHandlerBlock(image,error,cacheType,finished,imageURL);
|
71
|
+ if (completedBlock) {
|
|
|
72
|
+ completedBlock(image,error,cacheType,finished,imageURL);
|
91
|
}
|
73
|
}
|
92
|
}];
|
74
|
}];
|
93
|
}
|
75
|
}
|