diff --git a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismBaseInstructionParser+Protected.m b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismBaseInstructionParser+Protected.m index 5331ed5..5b9845e 100644 --- a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismBaseInstructionParser+Protected.m +++ b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismBaseInstructionParser+Protected.m @@ -251,6 +251,9 @@ - (void)highlightTheElement:(UIView*)element withCompletion:(void(^)(void))block if (self.needExecute && block) { block(); } + }); + + dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(0.5 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{ [redLayer removeFromSuperlayer]; }); }); diff --git a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismCellInstructionParser.m b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismCellInstructionParser.m index d70510a..3cb6dfc 100644 --- a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismCellInstructionParser.m +++ b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismCellInstructionParser.m @@ -68,11 +68,14 @@ - (PrismInstructionParseResult)parseWithFormatter:(PrismInstructionFormatter *)f if ([targetView isKindOfClass:[UITableViewCell class]]) { UITableView *tableView = [targetView prism_UITableViewBelow]; UITableViewCell *targetCell = (UITableViewCell*)targetView; - for (UITableViewCell *cell in [tableView visibleCells]) { - NSString *viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:cell needRecursive:YES]; - if ([viewContent containsString:representativeContent]) { - targetCell = cell; - break; + NSString *viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:targetCell needRecursive:YES]; + if (![viewContent containsString:representativeContent]) { + for (UITableViewCell *cell in [tableView visibleCells]) { + viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:cell needRecursive:YES]; + if ([viewContent containsString:representativeContent]) { + targetCell = cell; + break; + } } } NSIndexPath *cellIndexPath = [tableView indexPathForCell:targetCell]; @@ -86,11 +89,14 @@ - (PrismInstructionParseResult)parseWithFormatter:(PrismInstructionFormatter *)f else if ([targetView isKindOfClass:[UICollectionViewCell class]]) { UICollectionView *collectionView = [targetView prism_UICollectionViewBelow]; UICollectionViewCell *targetCell = (UICollectionViewCell*)targetView; - for (UICollectionViewCell *cell in [collectionView visibleCells]) { - NSString *viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:cell needRecursive:YES]; - if ([viewContent containsString:representativeContent]) { - targetCell = cell; - break; + NSString *viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:targetCell needRecursive:YES]; + if (![viewContent containsString:representativeContent]) { + for (UICollectionViewCell *cell in [collectionView visibleCells]) { + viewContent = [PrismInstructionContentUtil getRepresentativeContentOfView:cell needRecursive:YES]; + if ([viewContent containsString:representativeContent]) { + targetCell = cell; + break; + } } } NSIndexPath *cellIndexPath = [collectionView indexPathForCell:targetCell]; diff --git a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismControlInstructionParser.m b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismControlInstructionParser.m index fb5dc35..e5e7760 100644 --- a/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismControlInstructionParser.m +++ b/iOS/DiDiPrism/Src/Core/Instruction/Parser/PrismControlInstructionParser.m @@ -98,9 +98,6 @@ - (PrismInstructionParseResult)parseWithFormatter:(PrismInstructionFormatter *)f } } } - if (!targetControl) { - targetControl = [self searchControlWithArea:areaInfo withTargetClass:targetClass withAction:targetAction fromSuperView:targetView]; - } } // target + selector else if (viewFunctionArray.count) { @@ -184,7 +181,7 @@ - (UIControl*)searchControlWithArea:(NSString*)areaInfo } BOOL isAreaInfoEqual = [self isAreaInfoEqualBetween:controlAreaInfo withAnother:areaInfo allowCompatibleMode:NO]; if (isAreaInfoEqual - && (!representativeContent.length || ([representativeContent isEqualToString:controlViewContent] || [representativeContent isEqualToString:highlightedImageName])) + && (!representativeContent.length || ([representativeContent isEqualToString:controlViewContent] || [representativeContent isEqualToString:[NSString stringWithFormat:@"%@%@", kViewRepresentativeContentTypeLocalImage, highlightedImageName]] || [representativeContent isEqualToString:[NSString stringWithFormat:@"%@%@", kViewRepresentativeContentTypeNetworkImage, highlightedImageName]])) && (!targetClass || [target isKindOfClass:targetClass]) && (!action.length || [controlActions containsObject:action])) { return control; diff --git a/iOS/DiDiPrism/Src/Core/Instruction/Util/PrismInstructionContentUtil.m b/iOS/DiDiPrism/Src/Core/Instruction/Util/PrismInstructionContentUtil.m index a4c286b..a390078 100644 --- a/iOS/DiDiPrism/Src/Core/Instruction/Util/PrismInstructionContentUtil.m +++ b/iOS/DiDiPrism/Src/Core/Instruction/Util/PrismInstructionContentUtil.m @@ -116,8 +116,9 @@ + (void)recursiveSubviewsWithViews:(NSArray*)views break; } } + id wxComponent = [view prism_wxComponent]; - if ([wxComponent isKindOfClass:NSClassFromString(@"WXTextComponent")] || [view isKindOfClass:[UILabel class]]) { + if ([view isKindOfClass:[UILabel class]] || [wxComponent isKindOfClass:NSClassFromString(@"WXTextComponent")]) { if (!*firstTextView) { *firstTextView = view; } @@ -140,10 +141,10 @@ + (void)recursiveSubviewsWithViews:(NSArray*)views } } } - else if ([wxComponent isKindOfClass:NSClassFromString(@"WXImageComponent")] || [view isKindOfClass:[UIImageView class]]) { + else if ([view isKindOfClass:[UIImageView class]] || [wxComponent isKindOfClass:NSClassFromString(@"WXImageComponent")]) { [imageViews prism_addObject:view]; } - else if ([view isKindOfClass:[UIButton class]] || viewHasTapGesture) { + else if (view.userInteractionEnabled && ([view isKindOfClass:[UIButton class]] || viewHasTapGesture)) { // 不提取可交互view的信息,避免混淆。 continue; }