Skip to content
Merged
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
### Fixes

- Fix iOS UI profiling options being silently ignored ([#6012](https://github.com/getsentry/sentry-react-native/pull/6012))
- Fix `_experiments.enableUnhandledCPPExceptionsV2` being silently ignored on iOS ([#6014](https://github.com/getsentry/sentry-react-native/pull/6014))
- Check `captureReplay` return value in iOS bridge to avoid linking error events to uncaptured replays ([#6008](https://github.com/getsentry/sentry-react-native/pull/6008))
- Report the expected properties file path and any missing keys when using `flavorAware` on Android, instead of failing with an opaque `Illegal null value provided in this collection` error ([#6031](https://github.com/getsentry/sentry-react-native/pull/6031))

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1471,6 +1471,60 @@ - (void)testStartCreateOptionsWithDictionaryEmptyExperimentsDoesNotInstallConfig
}
#endif

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Enabled
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"_experiments" : @ {
@"enableUnhandledCPPExceptionsV2" : @YES,
},
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertTrue(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should be enabled");
}

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Disabled
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
@"_experiments" : @ {
@"enableUnhandledCPPExceptionsV2" : @NO,
},
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertFalse(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should be disabled");
}

- (void)testStartCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Default
{
NSError *error = nil;

NSDictionary *_Nonnull mockedReactNativeDictionary = @{
@"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456",
};
SentryOptions *actualOptions =
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];

XCTAssertNotNil(actualOptions, @"Did not create sentry options");
XCTAssertNil(error, @"Should not pass no error");
XCTAssertFalse(actualOptions.experimental.enableUnhandledCPPExceptionsV2,
@"enableUnhandledCPPExceptionsV2 should default to disabled");
}

- (void)testStartEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags
{
SentryEvent *testEvent = [[SentryEvent alloc] init];
Expand Down
8 changes: 7 additions & 1 deletion packages/core/ios/RNSentryStart.m
Original file line number Diff line number Diff line change
Expand Up @@ -140,9 +140,15 @@ + (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)
}
}

// Configure iOS UI Profiling from _experiments.profilingOptions
// Configure experimental options from _experiments
NSDictionary *experiments = mutableOptions[@"_experiments"];
if (experiments != nil && [experiments isKindOfClass:[NSDictionary class]]) {
BOOL enableUnhandledCPPExceptions =
[experiments[@"enableUnhandledCPPExceptionsV2"] boolValue];
[RNSentryExperimentalOptions setEnableUnhandledCPPExceptionsV2:enableUnhandledCPPExceptions
sentryOptions:sentryOptions];

// Configure iOS UI Profiling
NSDictionary *profilingOptions = experiments[@"profilingOptions"];
if (profilingOptions != nil && [profilingOptions isKindOfClass:[NSDictionary class]]) {
[RNSentryExperimentalOptions configureProfilingWithOptions:profilingOptions
Expand Down
Loading