...
|
...
|
@@ -55,22 +55,25 @@ |
|
|
|
|
|
- (NSURLSessionDataTask *)yher_dataTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error))completionHandler
|
|
|
{
|
|
|
if (completionHandler == nil) {
|
|
|
return [self yher_dataTaskWithRequest:request completionHandler:completionHandler];
|
|
|
}
|
|
|
|
|
|
return [self yher_dataTaskWithRequest:request completionHandler:^(NSData * _Nullable data, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
|
|
if (completionHandler) {
|
|
|
completionHandler(data,response,error);
|
|
|
}
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].httpPerformanceTrackEnable) {
|
|
|
if (error) {
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithSessionURL:[request.URL absoluteString] status:YHEventLoadStatusFailed];
|
|
|
}else{
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithSessionURL:[request.URL absoluteString] status:YHEventLoadStatusSuc];
|
|
|
}
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithRequest:request response:response];
|
|
|
}
|
|
|
}];
|
|
|
}
|
|
|
|
|
|
- (NSURLSessionDownloadTask *)yher_downloadTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error))completionHandler
|
|
|
{
|
|
|
if (completionHandler == nil) {
|
|
|
return [self yher_downloadTaskWithRequest:request completionHandler:completionHandler];
|
|
|
}
|
|
|
|
|
|
return [self yher_downloadTaskWithRequest:request completionHandler:^(NSURL * _Nullable location, NSURLResponse * _Nullable response, NSError * _Nullable error) {
|
|
|
|
...
|
...
|
@@ -78,11 +81,7 @@ |
|
|
completionHandler(location,response,error);
|
|
|
}
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].httpPerformanceTrackEnable) {
|
|
|
if (error) {
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithSessionURL:[NSString stringWithFormat:@"%@",location] status:YHEventLoadStatusFailed];
|
|
|
}else{
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithSessionURL:[NSString stringWithFormat:@"%@",location] status:YHEventLoadStatusSuc];
|
|
|
}
|
|
|
[[YH_EventCollector sharedInstance] timeEventEndWithRequest:request response:response];
|
|
|
}
|
|
|
}];
|
|
|
}
|
...
|
...
|
@@ -139,8 +138,7 @@ static inline BOOL yher_addMethod(Class class, SEL selector, Method method) { |
|
|
{
|
|
|
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].httpPerformanceTrackEnable) {
|
|
|
NSURLSessionTask *task = (NSURLSessionTask*)self;
|
|
|
NSString *url = [task.currentRequest.URL absoluteString];
|
|
|
[[YH_EventCollector sharedInstance] timeEventStartWithSessionURL:url];
|
|
|
[[YH_EventCollector sharedInstance] timeEventStartWithRequest:task.currentRequest];
|
|
|
}
|
|
|
[self yher_resume];
|
|
|
}
|
...
|
...
|
|