Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(replay): Add SentryMask and SentryUnmask iOS components #4224

Open
wants to merge 44 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 31 commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
0fc1b42
feat(replay): Add SentryMask and SentryUnmask native components
krystofwoldrich Oct 31, 2024
9933a86
add clang-format
krystofwoldrich Nov 4, 2024
e17ac31
apply the formatter
krystofwoldrich Nov 4, 2024
534cbce
Merge remote-tracking branch 'origin/main' into kw/feat/replay-custom…
krystofwoldrich Nov 4, 2024
ef863a1
Merge remote-tracking branch 'origin/main' into kw/internal/clag-format
krystofwoldrich Nov 4, 2024
d317e1e
Merge branch 'kw/internal/clag-format' into kw/feat/replay-custom-red…
krystofwoldrich Nov 4, 2024
eb9d2de
fix clang format
krystofwoldrich Nov 4, 2024
cbf400a
add native architecture masks for ios
krystofwoldrich Nov 5, 2024
be04dfc
Merge remote-tracking branch 'origin/main' into kw/feat/replay-custom…
krystofwoldrich Nov 5, 2024
77691bd
add js tests
krystofwoldrich Nov 5, 2024
45374be
fix eslint changing the native props interface to type
krystofwoldrich Nov 6, 2024
0a127d2
Fix mask components for non uikit builds
krystofwoldrich Nov 6, 2024
4f5b967
add changelog
krystofwoldrich Nov 6, 2024
eb64e8d
fix typo
krystofwoldrich Nov 6, 2024
32c45e4
fix ts3.8 type check test
krystofwoldrich Nov 6, 2024
691f8f4
Merge branch 'kw/fix/type-check' into kw/feat/replay-custom-redact-an…
krystofwoldrich Nov 6, 2024
02bb913
fix new arch build decoupled replay and replay mask
krystofwoldrich Nov 6, 2024
5315bb2
fix missing react native types
krystofwoldrich Nov 6, 2024
f07f155
Merge branch 'kw/fix/type-check' into kw/feat/replay-custom-redact-co…
krystofwoldrich Nov 6, 2024
1b1c435
Merge branch 'main' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 8, 2024
cdd3da8
Update mask sample
krystofwoldrich Nov 8, 2024
1170838
fix rn unmask class is added to unmask array
krystofwoldrich Nov 8, 2024
3a9e155
fix tests for custom classes
krystofwoldrich Nov 8, 2024
c02d06c
Update samples/react-native/src/App.tsx
krystofwoldrich Nov 11, 2024
9fe9c24
update redact example
krystofwoldrich Nov 11, 2024
845c260
fix changelog and macos sample
krystofwoldrich Nov 11, 2024
2edaeb0
fix rnsentry impl
krystofwoldrich Nov 11, 2024
503c992
Merge branch 'main' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 11, 2024
4f88064
fix class names tests
krystofwoldrich Nov 11, 2024
ddffa75
Merge branch 'kw/feat/replay-custom-redact-components' of github.com:…
krystofwoldrich Nov 11, 2024
e0ccb78
Update samples/react-native-macos/src/Screens/PlaygroundScreen.tsx
krystofwoldrich Nov 11, 2024
750df37
chore(deps): update Cocoa SDK to v8.41.0-beta.1 (#4295)
krystofwoldrich Nov 20, 2024
db1278a
release: 6.3.0-beta.2
getsentry-bot Nov 20, 2024
1feca0b
Merge branch 'release/6.3.0-beta.2' into 6.3.0-beta
Nov 20, 2024
9b2874c
Merge branch 'main' into 6.3.0-beta
krystofwoldrich Nov 21, 2024
ac1e5bb
Merge branch 'main' into 6.3.0-beta
krystofwoldrich Nov 21, 2024
d16bc9a
Merge branch '6.3.0-beta' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 21, 2024
d9cc0d9
fix custom fallback tests
krystofwoldrich Nov 21, 2024
e665141
Fix lint and typos
krystofwoldrich Nov 21, 2024
050acad
use mask/unmask classes directly
krystofwoldrich Nov 21, 2024
d50ffe2
fix changelog
krystofwoldrich Nov 21, 2024
624d26f
Merge remote-tracking branch 'origin/main' into 6.3.0-beta
krystofwoldrich Nov 22, 2024
414590c
Merge branch '6.3.0-beta' into kw/feat/replay-custom-redact-components
krystofwoldrich Nov 22, 2024
eb457fc
fix old RN builds, remove ts from shipped package
krystofwoldrich Nov 23, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,25 @@
export SENTRY_DISABLE_NATIVE_DEBUG_UPLOAD=true
```

- Add Replay Custom Masking for iOS ([#4238](https://github.com/getsentry/sentry-react-native/pull/4224))

```jsx
import * as Sentry from '@sentry/react-native';

const Example = () => {
return (
<View>
<Sentry.Mask>
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
<Text>${"All children of Sentry.Mask will be masked."}</Text>
</Sentry.Mask>
<Sentry.Unmask>
<Text>${"Only direct children will be unmasked."}</Text>
</Sentry.Unmask>
</View>
);
};
```

### Fixes

- Ignore JavascriptException to filter out obfuscated duplicate JS Errors on Android ([#4232](https://github.com/getsentry/sentry-react-native/pull/4232))
Expand Down
2 changes: 1 addition & 1 deletion packages/core/.npmignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
!react-native.config.js
!/ios/**/*
!/android/**/*
!src/js/NativeRNSentry.ts
!src/**/*
!scripts/collect-modules.sh
!scripts/copy-debugid.js
!scripts/has-sourcemap-debugid.js
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
/* Begin PBXBuildFile section */
332D33472CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */; };
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */; };
3380C6C42CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */; };
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */; };
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */; };
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */; };
Expand All @@ -27,6 +28,9 @@
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayBreadcrumbConverter.h; path = ../ios/RNSentryReplayBreadcrumbConverter.h; sourceTree = "<group>"; };
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryBreadcrumbTests.swift; sourceTree = "<group>"; };
3360898D29524164007C7730 /* RNSentryCocoaTesterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNSentryCocoaTesterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
3380C6C12CDEC5850018B9B6 /* RNSentryReplayUnmask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayUnmask.h; path = ../ios/Replay/RNSentryReplayUnmask.h; sourceTree = SOURCE_ROOT; };
3380C6C22CDEC6630018B9B6 /* RNSentryReplayMask.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayMask.h; path = ../ios/Replay/RNSentryReplayMask.h; sourceTree = SOURCE_ROOT; };
3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryReplayPostInitTests.swift; sourceTree = "<group>"; };
338739072A7D7D2800950DDD /* RNSentryReplay.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryReplay.h; path = ../ios/RNSentryReplay.h; sourceTree = "<group>"; };
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryOnDrawReporter.h; path = ../ios/RNSentryOnDrawReporter.h; sourceTree = "<group>"; };
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNSentryOnDrawReporterTests.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -94,13 +98,24 @@
33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */,
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */,
332D33462CDBDBB600547D76 /* RNSentryReplayOptionsTests.swift */,
3380C6C32CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift */,
);
path = RNSentryCocoaTesterTests;
sourceTree = "<group>";
};
3380C6C02CDEC56B0018B9B6 /* Replay */ = {
isa = PBXGroup;
children = (
3380C6C22CDEC6630018B9B6 /* RNSentryReplayMask.h */,
3380C6C12CDEC5850018B9B6 /* RNSentryReplayUnmask.h */,
);
path = Replay;
sourceTree = "<group>";
};
33AFE0122B8F319000AAB120 /* RNSentry */ = {
isa = PBXGroup;
children = (
3380C6C02CDEC56B0018B9B6 /* Replay */,
332D33482CDBDC7300547D76 /* RNSentry.h */,
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */,
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */,
Expand Down Expand Up @@ -226,6 +241,7 @@
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */,
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */,
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */,
3380C6C42CE25ECA0018B9B6 /* RNSentryReplayPostInitTests.swift in Sources */,
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
#import "RNSentryBreadcrumb.h"
#import "RNSentryReplay.h"
#import "RNSentryReplayBreadcrumbConverter.h"
#import "RNSentryReplayMask.h"
#import "RNSentryReplayUnmask.h"
Original file line number Diff line number Diff line change
Expand Up @@ -109,11 +109,7 @@ final class RNSentryReplayOptions: XCTestCase {
let sessionReplay = experimental["sessionReplay"] as! [String:Any]

let maskedViewClasses = sessionReplay["maskedViewClasses"] as! [String]
XCTAssertEqual(maskedViewClasses.count, 1)
XCTAssertEqual(maskedViewClasses[0], "RNSVGSvgView")

let actualOptions = try! Options(dict: optionsDict as! [String: Any])
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskedViewClasses.count, 0)
XCTAssertTrue(maskedViewClasses.contains("RNSVGSvgView"))
}

func testMaskAllImages() {
Expand All @@ -128,9 +124,7 @@ final class RNSentryReplayOptions: XCTestCase {
let actualOptions = try! Options(dict: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllImages, true)
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskedViewClasses.count, 1)
XCTAssertNotNil(actualOptions.experimental.sessionReplay.maskedViewClasses[0])
XCTAssertEqual(ObjectIdentifier(actualOptions.experimental.sessionReplay.maskedViewClasses[0]), ObjectIdentifier(NSClassFromString("RCTImageView")!))
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTImageView")
}

func testMaskAllImagesFalse() {
Expand Down Expand Up @@ -160,11 +154,16 @@ final class RNSentryReplayOptions: XCTestCase {
let actualOptions = try! Options(dict: optionsDict as! [String: Any])

XCTAssertEqual(actualOptions.experimental.sessionReplay.maskAllText, true)
XCTAssertEqual(actualOptions.experimental.sessionReplay.maskedViewClasses.count, 2)
XCTAssertNotNil(actualOptions.experimental.sessionReplay.maskedViewClasses[0])
XCTAssertNotNil(actualOptions.experimental.sessionReplay.maskedViewClasses[1])
XCTAssertEqual(ObjectIdentifier(actualOptions.experimental.sessionReplay.maskedViewClasses[0]), ObjectIdentifier(NSClassFromString("RCTTextView")!))
XCTAssertEqual(ObjectIdentifier(actualOptions.experimental.sessionReplay.maskedViewClasses[1]), ObjectIdentifier(NSClassFromString("RCTParagraphComponentView")!))
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTTextView")
assertContainsClass(classArray: actualOptions.experimental.sessionReplay.maskedViewClasses, stringClass: "RCTParagraphComponentView")
}

func assertContainsClass(classArray: [AnyClass], stringClass: String) {
XCTAssertTrue(mapToObjectIdentifiers(classArray: classArray).contains(ObjectIdentifier(NSClassFromString(stringClass)!)))
}

func mapToObjectIdentifiers(classArray: [AnyClass]) -> [ObjectIdentifier] {
return classArray.map { ObjectIdentifier($0) }
}

func testMaskAllTextFalse() {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import XCTest
import Sentry

final class RNSentryReplayPostInitTests: XCTestCase {

func testMask() {
XCTAssertEqual(ObjectIdentifier(RNSentryReplay.getMaskClass()), ObjectIdentifier(RNSentryReplayMask.self))
}

func testUnmask() {
XCTAssertEqual(ObjectIdentifier(RNSentryReplay.getUnmaskClass()), ObjectIdentifier(RNSentryReplayUnmask.self))
}
}
4 changes: 4 additions & 0 deletions packages/core/ios/RNSentryReplay.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,8 @@

+ (void)postInit;

+ (Class)getMaskClass;

+ (Class)getUnmaskClass;

@end
22 changes: 22 additions & 0 deletions packages/core/ios/RNSentryReplay.m
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#import "RNSentryReplay.h"
#import "RNSentryReplayBreadcrumbConverter.h"
#import "React/RCTTextView.h"

#if SENTRY_TARGET_REPLAY_SUPPORTED

Expand Down Expand Up @@ -36,6 +37,13 @@
forKey:@"experimental"];
}

+ (NSArray *_Nonnull)getReplayRNUnmaskClasses
{
// We can't import RNSentryReplayUnmask.h here because it's Objective-C++
// To avoid typos, we test the class existens in the tests
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
return @[ @"RNSentryReplayUnmask" ];
}

+ (NSArray *_Nonnull)getReplayRNRedactClasses:(NSDictionary *_Nullable)replayOptions
{
NSMutableArray *_Nonnull classesToRedact = [[NSMutableArray alloc] init];
Expand All @@ -56,10 +64,24 @@

+ (void)postInit
{
// We can't import RNSentryReplayMask.h here because it's Objective-C++
// To avoid typos, we test the class existens in the tests
krystofwoldrich marked this conversation as resolved.
Show resolved Hide resolved
[PrivateSentrySDKOnly setRedactContainerClass:[self getMaskClass]];

Check failure on line 69 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / metrics (legacy, ios)

no known class method for selector 'setRedactContainerClass:'

Check failure on line 69 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build new ios production no-frameworks

no known class method for selector 'setRedactContainerClass:'

Check failure on line 69 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios dev dynamic-frameworks

no known class method for selector 'setRedactContainerClass:'

Check failure on line 69 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios dev no-frameworks

no known class method for selector 'setRedactContainerClass:'

Check failure on line 69 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios production no-frameworks

no known class method for selector 'setRedactContainerClass:'
[PrivateSentrySDKOnly setIgnoreContainerClass:[self getUnmaskClass]];

Check failure on line 70 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / metrics (legacy, ios)

no known class method for selector 'setIgnoreContainerClass:'

Check failure on line 70 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build new ios production no-frameworks

no known class method for selector 'setIgnoreContainerClass:'

Check failure on line 70 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios dev dynamic-frameworks

no known class method for selector 'setIgnoreContainerClass:'

Check failure on line 70 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios dev no-frameworks

no known class method for selector 'setIgnoreContainerClass:'

Check failure on line 70 in packages/core/ios/RNSentryReplay.m

View workflow job for this annotation

GitHub Actions / Build legacy ios production no-frameworks

no known class method for selector 'setIgnoreContainerClass:'
RNSentryReplayBreadcrumbConverter *breadcrumbConverter =
[[RNSentryReplayBreadcrumbConverter alloc] init];
[PrivateSentrySDKOnly configureSessionReplayWith:breadcrumbConverter screenshotProvider:nil];
}

+ (Class) getMaskClass
{
return NSClassFromString(@"RNSentryReplayMask");
antonis marked this conversation as resolved.
Show resolved Hide resolved
}

+ (Class) getUnmaskClass
{
return NSClassFromString(@"RNSentryReplayUnmask");
}

@end
#endif
24 changes: 24 additions & 0 deletions packages/core/ios/Replay/RNSentryReplayMask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import <Sentry/SentryDefines.h>

#if SENTRY_HAS_UIKIT

# import <React/RCTViewManager.h>

# ifdef RCT_NEW_ARCH_ENABLED
# import <React/RCTViewComponentView.h>
# else
# import <React/RCTView.h>
# endif

@interface RNSentryReplayMaskManager : RCTViewManager
@end

@interface RNSentryReplayMask :
# ifdef RCT_NEW_ARCH_ENABLED
RCTViewComponentView
# else
RCTView
# endif
@end

#endif
51 changes: 51 additions & 0 deletions packages/core/ios/Replay/RNSentryReplayMask.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#import <Sentry/SentryDefines.h>

#if SENTRY_HAS_UIKIT

# import "RNSentryReplayMask.h"

# ifdef RCT_NEW_ARCH_ENABLED
# import <react/renderer/components/RNSentrySpec/ComponentDescriptors.h>
# import <react/renderer/components/RNSentrySpec/RCTComponentViewHelpers.h>
// RCTFabricComponentsPlugins needed for RNSentryReplayMaskCls
# import <React/RCTFabricComponentsPlugins.h>
# endif

@implementation RNSentryReplayMaskManager

RCT_EXPORT_MODULE(RNSentryReplayMask)

- (UIView *)view
{
return [RNSentryReplayMask new];
}

@end

# ifdef RCT_NEW_ARCH_ENABLED
@interface
RNSentryReplayMask () <RCTRNSentryReplayMaskViewProtocol>
@end
# endif

@implementation RNSentryReplayMask

# ifdef RCT_NEW_ARCH_ENABLED
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
{
return facebook::react::concreteComponentDescriptorProvider<
facebook::react::RNSentryReplayMaskComponentDescriptor>();
}
# endif

@end

# ifdef RCT_NEW_ARCH_ENABLED
Class<RCTComponentViewProtocol>
RNSentryReplayMaskCls(void)
{
return RNSentryReplayMask.class;
}
# endif

#endif
24 changes: 24 additions & 0 deletions packages/core/ios/Replay/RNSentryReplayUnmask.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#import <Sentry/SentryDefines.h>

#if SENTRY_HAS_UIKIT

# import <React/RCTViewManager.h>

# ifdef RCT_NEW_ARCH_ENABLED
# import <React/RCTViewComponentView.h>

Check failure on line 8 in packages/core/ios/Replay/RNSentryReplayUnmask.h

View workflow job for this annotation

GitHub Actions / metrics (new, ios)

'React/RCTViewComponentView.h' file not found
# else
# import <React/RCTView.h>
# endif

@interface RNSentryReplayUnmaskManager : RCTViewManager
@end

@interface RNSentryReplayUnmask :
# ifdef RCT_NEW_ARCH_ENABLED
RCTViewComponentView
# else
RCTView
# endif
@end

#endif
51 changes: 51 additions & 0 deletions packages/core/ios/Replay/RNSentryReplayUnmask.mm
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#import <Sentry/SentryDefines.h>

#if SENTRY_HAS_UIKIT

# import "RNSentryReplayUnmask.h"

# ifdef RCT_NEW_ARCH_ENABLED
# import <react/renderer/components/RNSentrySpec/ComponentDescriptors.h>
# import <react/renderer/components/RNSentrySpec/RCTComponentViewHelpers.h>
// RCTFabricComponentsPlugins needed for RNSentryReplayUnmaskCls
# import <React/RCTFabricComponentsPlugins.h>
# endif

@implementation RNSentryReplayUnmaskManager

RCT_EXPORT_MODULE(RNSentryReplayUnmask)

- (UIView *)view
{
return [RNSentryReplayUnmask new];
}

@end

# ifdef RCT_NEW_ARCH_ENABLED
@interface
RNSentryReplayUnmask () <RCTRNSentryReplayUnmaskViewProtocol>
@end
# endif

@implementation RNSentryReplayUnmask

# ifdef RCT_NEW_ARCH_ENABLED
+ (facebook::react::ComponentDescriptorProvider)componentDescriptorProvider
{
return facebook::react::concreteComponentDescriptorProvider<
facebook::react::RNSentryReplayUnmaskComponentDescriptor>();
}
# endif

@end

# ifdef RCT_NEW_ARCH_ENABLED
Class<RCTComponentViewProtocol>
RNSentryReplayUnmaskCls(void)
{
return RNSentryReplayUnmask.class;
}
# endif

#endif
3 changes: 2 additions & 1 deletion packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
"typescript": {
"definition": "dist/js/index.d.ts"
},
"react-native": "src/js/index.ts",
"main": "dist/js/index.js",
"scripts": {
"build": "npx run-s build:sdk downlevel build:tools build:plugin",
Expand Down Expand Up @@ -118,7 +119,7 @@
},
"codegenConfig": {
"name": "RNSentrySpec",
"type": "modules",
"type": "all",
lucas-zimerman marked this conversation as resolved.
Show resolved Hide resolved
"jsSrcsDir": "src",
"android": {
"javaPackageName": "io.sentry.react"
Expand Down
10 changes: 10 additions & 0 deletions packages/core/src/js/RNSentryReplayMaskNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { HostComponent, ViewProps } from 'react-native';
// The default export exists in the file but eslint doesn't see it
// eslint-disable-next-line import/default
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

// If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface NativeProps extends ViewProps {}

export default codegenNativeComponent<NativeProps>('RNSentryReplayMask') as HostComponent<NativeProps>;
10 changes: 10 additions & 0 deletions packages/core/src/js/RNSentryReplayUnmaskNativeComponent.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import type { HostComponent, ViewProps } from 'react-native';
// The default export exists in the file but eslint doesn't see it
// eslint-disable-next-line import/default
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';

// If changed to type NativeProps = ViewProps, react native codegen will fail finding the NativeProps type
// eslint-disable-next-line @typescript-eslint/no-empty-interface
export interface NativeProps extends ViewProps {}

export default codegenNativeComponent<NativeProps>('RNSentryReplayUnmask') as HostComponent<NativeProps>;
Loading
Loading