Skip to content

Commit

Permalink
chore: test redaction/unredaction through obj-c
Browse files Browse the repository at this point in the history
  • Loading branch information
jribeiro committed Oct 27, 2022
1 parent f402e81 commit ad3fed9
Show file tree
Hide file tree
Showing 4 changed files with 1,877 additions and 759 deletions.
31 changes: 31 additions & 0 deletions Example/ios/Example/AppDelegate.m
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,42 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
#endif
}

-(UIView *)findViewByAccessibilityLabel:(UIView *)parent :(NSString *)accessibilityLabel {
if (parent.subviews.count > 0) {
for (UIView *subView in parent.subviews) {
NSLog(@"View:::: Class:%@, Tag: %ld, Description:%@, Hash:%lu", [subView class], [subView tag], [subView accessibilityLabel], [subView hash]);

if ([subView.accessibilityLabel isEqualToString:accessibilityLabel] == YES) {
NSLog(@"Found UIAlertController! with Class:%@, Tag: %ld, Description:%@, Hash:%lu", [subView class], [subView tag], [subView description], [subView hash]);
return subView;
}

UIView *result = [self findViewByAccessibilityLabel:subView:accessibilityLabel];
if (result) {
return result;
}
}
}

return nil;
}

-(NSArray<UIView *> *)cobrowseRedactedViewsForViewController:(UIViewController *)vc {
UIView *devMenu = [self findViewByAccessibilityLabel:self.window:@"React Native Debug Menu"];

if (devMenu) {
return @[self.window.rootViewController.view, devMenu];
}

return @[self.window.rootViewController.view];
}

-(NSArray<UIView *> *)cobrowseUnredactedViewsForViewController:(UIViewController *)vc {
UIView *bundlerConfig = [self findViewByAccessibilityLabel:self.window:@"Configure Bundler"];

if (bundlerConfig) {
return @[bundlerConfig];
}
return @[];
}

Expand Down
8 changes: 4 additions & 4 deletions Example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
PODS:
- boost-for-react-native (1.63.0)
- cobrowse-sdk-react-native (2.12.0):
- cobrowse-sdk-react-native (2.13.0):
- CobrowseIO/XCFramework (= 2.22.1)
- React
- CobrowseIO/XCFramework (2.22.1):
Expand Down Expand Up @@ -379,11 +379,11 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
boost-for-react-native: 39c7adb57c4e60d6c5479dd8623128eb5b3f0f2c
cobrowse-sdk-react-native: a4266f0cfa4e15666ee9420da58e11856f181f73
cobrowse-sdk-react-native: 1daee85a275595e88d4210b0da85d68eac9ac3ed
CobrowseIO: 1a8f15837ca39b881263cc8e611275de17801e9d
DoubleConversion: cf9b38bf0b2d048436d9a82ad2abe1404f11e7de
FBLazyVector: e686045572151edef46010a6f819ade377dfeb4b
FBReactNativeSpec: 4261e14597fd1035b5e9238b4a097e37d53242b9
FBReactNativeSpec: bbf8cc7a93599b6c1221ce1151279ca67cf80543
glog: 73c2498ac6884b13ede40eda8228cb1eee9d9d62
RCT-Folly: ec7a233ccc97cc556cf7237f0db1ff65b986f27c
RCTRequired: 6d3e854f0e7260a648badd0d44fc364bc9da9728
Expand Down Expand Up @@ -414,4 +414,4 @@ SPEC CHECKSUMS:

PODFILE CHECKSUM: b487f00a31e45b097ad58f5f636daa87a8a0729b

COCOAPODS: 1.11.2
COCOAPODS: 1.11.3
Loading

0 comments on commit ad3fed9

Please sign in to comment.