Showing
1 changed file
with
0 additions
and
30 deletions
@@ -8,7 +8,6 @@ | @@ -8,7 +8,6 @@ | ||
8 | 8 | ||
9 | #import "SDWebImageDownloaderOperation+Performance.h" | 9 | #import "SDWebImageDownloaderOperation+Performance.h" |
10 | #import "Aspects.h" | 10 | #import "Aspects.h" |
11 | -#import "YH_Analytics.h" | ||
12 | 11 | ||
13 | @implementation SDWebImageDownloaderOperation (Performance) | 12 | @implementation SDWebImageDownloaderOperation (Performance) |
14 | 13 | ||
@@ -23,14 +22,7 @@ | @@ -23,14 +22,7 @@ | ||
23 | // finish | 22 | // finish |
24 | [SDWebImageDownloaderOperation aspect_hookSelector:@selector(operationDidFinish) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo>aspectInfo){ | 23 | [SDWebImageDownloaderOperation aspect_hookSelector:@selector(operationDidFinish) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo>aspectInfo){ |
25 | SDWebImageDownloaderOperation *op = [aspectInfo instance]; | 24 | SDWebImageDownloaderOperation *op = [aspectInfo instance]; |
26 | - | ||
27 | - NSTimeInterval currentTS = [[NSDate date]timeIntervalSince1970]; | ||
28 | - | ||
29 | NSInteger status = -1; | 25 | NSInteger status = -1; |
30 | - long deltaTS = (currentTS - op.begainLoadImageTimestamp) * 1000; | ||
31 | - NSString *url = [SDWebImageDownloaderOperation urlWithOperation:op]; | ||
32 | - NSString *opAddr = [NSString stringWithFormat:@"%p", op]; | ||
33 | - | ||
34 | if (op.response) { | 26 | if (op.response) { |
35 | if ([op.response isKindOfClass:[NSHTTPURLResponse class]]) { | 27 | if ([op.response isKindOfClass:[NSHTTPURLResponse class]]) { |
36 | NSHTTPURLResponse *response = (NSHTTPURLResponse *)op.response; | 28 | NSHTTPURLResponse *response = (NSHTTPURLResponse *)op.response; |
@@ -40,14 +32,6 @@ | @@ -40,14 +32,6 @@ | ||
40 | // success | 32 | // success |
41 | status = 1; | 33 | status = 1; |
42 | } | 34 | } |
43 | - | ||
44 | - [[YH_Analytics sharedInstance]logPerformanceWithType:kPerformanceTypeImageLoad | ||
45 | - parameters:@{JsonKeyPerformanceEvtEID:opAddr?:@"", | ||
46 | - JsonKeyPerformanceURL: url?:@"", | ||
47 | - JsonKeyPerformanceTS: @((long)(op.begainLoadImageTimestamp*1000)), | ||
48 | - JsonKeyPerformanceCTS:@(deltaTS), | ||
49 | - JsonKeyPerformanceSTATUS : @(status) | ||
50 | - }]; | ||
51 | } | 35 | } |
52 | 36 | ||
53 | } error:NULL]; | 37 | } error:NULL]; |
@@ -56,25 +40,11 @@ | @@ -56,25 +40,11 @@ | ||
56 | // error | 40 | // error |
57 | [SDWebImageDownloaderOperation aspect_hookSelector:@selector(operationError:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo>aspectInfo){ | 41 | [SDWebImageDownloaderOperation aspect_hookSelector:@selector(operationError:) withOptions:AspectPositionAfter usingBlock:^(id<AspectInfo>aspectInfo){ |
58 | SDWebImageDownloaderOperation *op = [aspectInfo instance]; | 42 | SDWebImageDownloaderOperation *op = [aspectInfo instance]; |
59 | - | ||
60 | - NSTimeInterval currentTS = [[NSDate date]timeIntervalSince1970]; | ||
61 | - | ||
62 | - long deltaTS = (currentTS - op.begainLoadImageTimestamp) * 1000; | ||
63 | - NSString *url = [SDWebImageDownloaderOperation urlWithOperation:op]; | ||
64 | - NSString *opAddr = [NSString stringWithFormat:@"%p", op]; | ||
65 | - | ||
66 | // error code default is `-1` | 43 | // error code default is `-1` |
67 | NSInteger errorCode = -1; | 44 | NSInteger errorCode = -1; |
68 | if (op.error) { | 45 | if (op.error) { |
69 | errorCode = [op.error code]; | 46 | errorCode = [op.error code]; |
70 | } | 47 | } |
71 | - [[YH_Analytics sharedInstance]logPerformanceWithType:kPerformanceTypeImageLoad | ||
72 | - parameters:@{JsonKeyPerformanceEvtEID:opAddr?:@"", | ||
73 | - JsonKeyPerformanceURL: url?:@"", | ||
74 | - JsonKeyPerformanceTS: @((long)(op.begainLoadImageTimestamp*1000)), | ||
75 | - JsonKeyPerformanceCTS:@(deltaTS), | ||
76 | - JsonKeyPerformanceSTATUS : @(errorCode) | ||
77 | - }]; | ||
78 | } error:NULL]; | 48 | } error:NULL]; |
79 | 49 | ||
80 | // cancel | 50 | // cancel |
-
Please register or login to post a comment