Authored by 孙凯

修改 手势时间 方案 review by hongmo

... ... @@ -73,30 +73,39 @@
#pragma mark - hook API
-(void)yher_setDelegate:(id<UIGestureRecognizerDelegate>)delegate
{
[self yher_setDelegate:self];
if (![delegate isKindOfClass:[self class]]) {
[self setMy_delegate:delegate];
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([delegate isKindOfClass:[UIViewController class]] || [delegate isKindOfClass:[UIImageView class]] || [delegate isKindOfClass:[UILabel class]])) {
if (![delegate isKindOfClass:[self class]]) {
[self setMy_delegate:delegate];
}
}
[self yher_setDelegate:delegate];
}
- (instancetype)yher_initWithTarget:(nullable id)target action:(nullable SEL)action
{
[UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
[self setDelegate:target];
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([target isKindOfClass:[UIViewController class]] || [target isKindOfClass:[UIImageView class]] || [target isKindOfClass:[UILabel class]])) {
[UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
[self setDelegate:target];
}
return [self yher_initWithTarget:target action:action];
}
- (void)yher_addTarget:(id)target action:(SEL)action
{
[UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
[self setDelegate:target];
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([target isKindOfClass:[UIViewController class]] || [target isKindOfClass:[UIImageView class]] || [target isKindOfClass:[UILabel class]])) {
[UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
[self setDelegate:target];
}
[self yher_addTarget:target action:action];
}
#pragma mark - action
- (void)yher_gestureRecognizerDidTouch_cmd:(UIGestureRecognizer*)sender
{
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable) {
if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([sender.view isKindOfClass:[UIImageView class]] || [sender.view isKindOfClass:[UILabel class]])) {
[[YH_EventCollector sharedInstance] timeEventEndWithUIGestureRecognizer:sender];
}
... ...