Authored by 孙凯

修改 手势时间 方案 review by hongmo

@@ -73,30 +73,39 @@ @@ -73,30 +73,39 @@
73 #pragma mark - hook API 73 #pragma mark - hook API
74 -(void)yher_setDelegate:(id<UIGestureRecognizerDelegate>)delegate 74 -(void)yher_setDelegate:(id<UIGestureRecognizerDelegate>)delegate
75 { 75 {
76 - [self yher_setDelegate:self];  
77 - if (![delegate isKindOfClass:[self class]]) {  
78 - [self setMy_delegate:delegate]; 76 + if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([delegate isKindOfClass:[UIViewController class]] || [delegate isKindOfClass:[UIImageView class]] || [delegate isKindOfClass:[UILabel class]])) {
  77 + if (![delegate isKindOfClass:[self class]]) {
  78 + [self setMy_delegate:delegate];
  79 + }
79 } 80 }
  81 + [self yher_setDelegate:delegate];
  82 +
80 } 83 }
81 84
82 - (instancetype)yher_initWithTarget:(nullable id)target action:(nullable SEL)action 85 - (instancetype)yher_initWithTarget:(nullable id)target action:(nullable SEL)action
83 { 86 {
84 - [UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];  
85 - [self setDelegate:target]; 87 + if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([target isKindOfClass:[UIViewController class]] || [target isKindOfClass:[UIImageView class]] || [target isKindOfClass:[UILabel class]])) {
  88 + [UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
  89 + [self setDelegate:target];
  90 + }
86 return [self yher_initWithTarget:target action:action]; 91 return [self yher_initWithTarget:target action:action];
87 } 92 }
88 93
89 - (void)yher_addTarget:(id)target action:(SEL)action 94 - (void)yher_addTarget:(id)target action:(SEL)action
90 { 95 {
91 - [UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];  
92 - [self setDelegate:target]; 96 + if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([target isKindOfClass:[UIViewController class]] || [target isKindOfClass:[UIImageView class]] || [target isKindOfClass:[UILabel class]])) {
  97 + [UIGestureRecognizer yher_exchangeSelector:action target:target toSelector:@selector(yher_gestureRecognizerDidTouch_cmd:)];
  98 + [self setDelegate:target];
  99 + }
  100 +
93 [self yher_addTarget:target action:action]; 101 [self yher_addTarget:target action:action];
94 } 102 }
95 103
96 #pragma mark - action 104 #pragma mark - action
97 - (void)yher_gestureRecognizerDidTouch_cmd:(UIGestureRecognizer*)sender 105 - (void)yher_gestureRecognizerDidTouch_cmd:(UIGestureRecognizer*)sender
98 { 106 {
99 - if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable) { 107 +
  108 + if ([YHEventReport sharedInstance].isPerformanceTrackEnabled && [YHEventReport sharedInstance].buttonPerformanceTrackEnable && ([sender.view isKindOfClass:[UIImageView class]] || [sender.view isKindOfClass:[UILabel class]])) {
100 [[YH_EventCollector sharedInstance] timeEventEndWithUIGestureRecognizer:sender]; 109 [[YH_EventCollector sharedInstance] timeEventEndWithUIGestureRecognizer:sender];
101 } 110 }
102 111