diff --git a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m index c2f3ad5ad6..862625f944 100644 --- a/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m +++ b/packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.m @@ -2,7 +2,6 @@ #import "RNSentry+Test.h" #import "RNSentryReplay.h" #import "RNSentryStart+Test.h" -#import "SentrySDKWrapper.h" #import #import #import @@ -17,420 +16,6 @@ @interface RNSentryInitNativeSdkTests : XCTestCase @implementation RNSentryInitNativeSdkTests -- (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = - @{ @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"beforeSend" : @"will_be_overwritten", - @"tracesSampleRate" : @1, - @"tracesSampler" : ^(SentrySamplingContext *_Nonnull samplingContext) { return @1; -} -, @"enableTracing" : @YES, -} -; -mockedReactNativeDictionary = [rnSentry prepareOptions:mockedReactNativeDictionary]; -SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - -XCTAssertNotNil(actualOptions, @"Did not create sentry options"); -XCTAssertNil(error, @"Should not pass no error"); -XCTAssertNotNil( - actualOptions.beforeSend, @"Before send is overwriten by the native RNSentry implementation"); -XCTAssertEqual( - actualOptions.tracesSampleRate, nil, @"Traces sample rate should not be passed to native"); -XCTAssertEqual(actualOptions.tracesSampler, nil, @"Traces sampler should not be passed to native"); -// Note: enableTracing property is deprecated in Sentry Cocoa SDK v7 -// Tracing is disabled by setting tracesSampleRate and tracesSampler to nil -} - -- (void)testCaptureFailedRequestsIsDisabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertFalse(actualOptions.enableCaptureFailedRequests); -} - -- (void)testCreateOptionsWithDictionaryNativeCrashHandlingDefault -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertTrue(actualOptions.enableCrashHandler, @"Did not set native crash handling"); -} - -- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDefault -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertEqual( - actualOptions.enableAutoPerformanceTracing, true, @"Did not set Auto Performance Tracing"); -} - -- (void)testCreateOptionsWithDictionaryNativeCrashHandlingEnabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableNativeCrashHandling" : @YES, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertTrue(actualOptions.enableCrashHandler, @"Did not set native crash handling"); -} - -- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingEnabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableAutoPerformanceTracing" : @YES, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertEqual( - actualOptions.enableAutoPerformanceTracing, true, @"Did not set Auto Performance Tracing"); -} - -- (void)testCreateOptionsWithDictionaryNativeCrashHandlingDisabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableNativeCrashHandling" : @NO, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertFalse(actualOptions.enableCrashHandler, @"Did not disable native crash handling"); -} - -- (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDisabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableAutoPerformanceTracing" : @NO, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertEqual(actualOptions.enableAutoPerformanceTracing, false, - @"Did not disable Auto Performance Tracing"); -} - -- (void)testCreateOptionsWithDictionarySpotlightEnabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"spotlight" : @YES, - @"defaultSidecarUrl" : @"http://localhost:8969/teststream", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight"); - XCTAssertEqual(actualOptions.spotlightUrl, @"http://localhost:8969/teststream"); -} - -- (void)testCreateOptionsWithDictionarySpotlightOne -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"spotlight" : @1, - @"defaultSidecarUrl" : @"http://localhost:8969/teststream", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight"); - XCTAssertEqual(actualOptions.spotlightUrl, @"http://localhost:8969/teststream"); -} - -- (void)testCreateOptionsWithDictionarySpotlightUrl -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"spotlight" : @"http://localhost:8969/teststream", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight"); - XCTAssertEqual(actualOptions.spotlightUrl, @"http://localhost:8969/teststream"); -} - -- (void)testCreateOptionsWithDictionarySpotlightDisabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"spotlight" : @NO, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertFalse(actualOptions.enableSpotlight, @"Did not disable spotlight"); -} - -- (void)testCreateOptionsWithDictionarySpotlightZero -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"spotlight" : @0, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - XCTAssertFalse(actualOptions.enableSpotlight, @"Did not disable spotlight"); -} - -- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Enabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"_experiments" : @ { - @"enableUnhandledCPPExceptionsV2" : @YES, - }, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - - id experimentalOptions = [actualOptions valueForKey:@"experimental"]; - XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil"); - - BOOL enableUnhandledCPPExceptions = - [[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue]; - XCTAssertTrue( - enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should be enabled"); -} - -- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Disabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"_experiments" : @ { - @"enableUnhandledCPPExceptionsV2" : @NO, - }, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - - id experimentalOptions = [actualOptions valueForKey:@"experimental"]; - XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil"); - - BOOL enableUnhandledCPPExceptions = - [[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue]; - XCTAssertFalse( - enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should be disabled"); -} - -- (void)testCreateOptionsWithDictionaryEnableUnhandledCPPExceptionsV2Default -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - - // Test that when no _experiments are provided, the experimental option defaults to false - id experimentalOptions = [actualOptions valueForKey:@"experimental"]; - XCTAssertNotNil(experimentalOptions, @"Experimental options should not be nil"); - - BOOL enableUnhandledCPPExceptions = - [[experimentalOptions valueForKey:@"enableUnhandledCPPExceptionsV2"] boolValue]; - XCTAssertFalse( - enableUnhandledCPPExceptions, @"enableUnhandledCPPExceptionsV2 should default to disabled"); -} - -- (void)testCreateOptionsWithDictionaryEnableLogsEnabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableLogs" : @YES, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - - BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue]; - XCTAssertTrue(enableLogs, @"enableLogs should be enabled"); -} - -- (void)testCreateOptionsWithDictionaryEnableLogsDisabled -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", - @"enableLogs" : @NO, - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNotNil(actualOptions, @"Did not create sentry options"); - XCTAssertNil(error, @"Should not pass no error"); - BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue]; - XCTAssertFalse(enableLogs, @"enableLogs should be disabled"); -} - -- (void)testPassesErrorOnWrongDsn -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedReactNativeDictionary = @{ - @"dsn" : @"not_a_valid_dsn", - }; - SentryOptions *actualOptions = - [SentrySDKWrapper createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; - - XCTAssertNil(actualOptions, @"Created invalid sentry options"); - XCTAssertNotNil(error, @"Did not created error on invalid dsn"); -} - -- (void)testBeforeBreadcrumbsCallbackFiltersOutSentryDsnRequestBreadcrumbs -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - - NSDictionary *_Nonnull mockedDictionary = @{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"devServerUrl" : @"http://localhost:8081" - }; - mockedDictionary = [rnSentry prepareOptions:mockedDictionary]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedDictionary - error:&error]; - SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init]; - breadcrumb.type = @"http"; - breadcrumb.data = @{ @"url" : @"https://def.ingest.sentry.io/1234567" }; - - SentryBreadcrumb *result = options.beforeBreadcrumb(breadcrumb); - - XCTAssertNil(result, @"Breadcrumb should be filtered out"); -} - -- (void)testBeforeBreadcrumbsCallbackFiltersOutDevServerRequestBreadcrumbs -{ - NSError *error = nil; - - NSString *mockDevServer = @"http://localhost:8081"; - - NSDictionary *_Nonnull mockedDictionary = - @{ @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", @"devServerUrl" : mockDevServer }; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedDictionary - error:&error]; - SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init]; - breadcrumb.type = @"http"; - breadcrumb.data = @{ @"url" : mockDevServer }; - - SentryBreadcrumb *result = options.beforeBreadcrumb(breadcrumb); - - XCTAssertNil(result, @"Breadcrumb should be filtered out"); -} - -- (void)testBeforeBreadcrumbsCallbackDoesNotFiltersOutNonDevServerOrDsnRequestBreadcrumbs -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedDictionary = @{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"devServerUrl" : @"http://localhost:8081" - }; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedDictionary - error:&error]; - SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init]; - breadcrumb.type = @"http"; - breadcrumb.data = @{ @"url" : @"http://testurl.com/service" }; - - SentryBreadcrumb *result = options.beforeBreadcrumb(breadcrumb); - - XCTAssertEqual(breadcrumb, result); -} - -- (void)testBeforeBreadcrumbsCallbackKeepsBreadcrumbWhenDevServerUrlIsNotPassedAndDsnDoesNotMatch -{ - NSError *error = nil; - - NSDictionary *_Nonnull mockedDictionary = @{ // dsn is always validated in SentryOptions initialization - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567" - }; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedDictionary - error:&error]; - SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init]; - breadcrumb.type = @"http"; - breadcrumb.data = @{ @"url" : @"http://testurl.com/service" }; - - SentryBreadcrumb *result = options.beforeBreadcrumb(breadcrumb); - - XCTAssertEqual(breadcrumb, result); -} - - (void)testEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags { RNSentry *rnSentry = [[RNSentry alloc] init]; @@ -538,265 +123,64 @@ - (void)testFetchNativeStackFramesByInstructionsServerSymbolication symbolicate:sucessfulSymbolicate]; NSDictionary *expected = @{ - @"debugMetaImages" : @[ - @{ - @"uuid" : @"mockuuid", - @"debug_id" : @"mockdebugid", - @"type" : @"macho", - @"image_addr" : @"0x000000000001b669", - }, - ], - @"frames" : @[ - @{ - @"package" : @"testnameone", - @"in_app" : @NO, - @"platform" : @"cocoa", - @"instruction_addr" : @"0x000000000000007b", // 123 - @"image_addr" : @"0x000000000001b669", // 112233 - }, - @{ - @"package" : @"testnametwo", - @"in_app" : @NO, - @"platform" : @"cocoa", - @"instruction_addr" : @"0x00000000000001c8", // 456 - @"image_addr" : @"0x000000000001b669", // 445566 - }, - ], - }; - XCTAssertTrue([actual isEqualToDictionary:expected]); -} - -- (void)testFetchNativeStackFramesByInstructionsOnDeviceSymbolication -{ - [self prepareNativeFrameMocksWithLocalSymbolication:YES]; - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSDictionary *actual = [rnSentry fetchNativeStackFramesBy:@[ @123, @456 ] - symbolicate:sucessfulSymbolicate]; - - NSDictionary *expected = @{ - @"frames" : @[ - @{ - @"function" : @"symbolicatedname", - @"package" : @"testnameone", - @"in_app" : @NO, - @"platform" : @"cocoa", - @"symbol_addr" : @"0x000000000000007b", // 123 - @"instruction_addr" : @"0x000000000000007b", // 123 - @"image_addr" : @"0x000000000001b669", // 112233 - }, - @{ - @"function" : @"symbolicatedname", - @"package" : @"testnametwo", - @"in_app" : @NO, - @"platform" : @"cocoa", - @"symbol_addr" : @"0x000000000000007b", // 123 - @"instruction_addr" : @"0x00000000000001c8", // 456 - @"image_addr" : @"0x000000000001b669", // 445566 - }, - ], - }; - XCTAssertTrue([actual isEqualToDictionary:expected]); -} - -- (void)testIgnoreErrorsDropsMatchingExceptionValue -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ] - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNil(error); - SentryEvent *event = [[SentryEvent alloc] init]; - SentryException *exception = [SentryException alloc]; - exception.value = @"IgnoreMe: This should be ignored"; - event.exceptions = @[ exception ]; - SentryEvent *result = options.beforeSend(event); - XCTAssertNil(result, @"Event with matching exception.value should be dropped"); -} - -- (void)testIgnoreErrorsDropsMatchingEventMessage -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"ignoreErrorsStr" : @[ @"DropThisError" ] - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNotNil(options); - XCTAssertNil(error); - SentryEvent *event = [[SentryEvent alloc] init]; - SentryMessage *msg = [SentryMessage alloc]; - msg.message = @"DropThisError: should be dropped"; - event.message = msg; - SentryEvent *result = options.beforeSend(event); - XCTAssertNil(result, @"Event with matching event.message.formatted should be dropped"); -} - -- (void)testIgnoreErrorsDoesNotDropNonMatchingEvent -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ] - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNotNil(options); - XCTAssertNil(error); - SentryEvent *event = [[SentryEvent alloc] init]; - SentryException *exception = [SentryException alloc]; - exception.value = @"SomeOtherError: should not be ignored"; - event.exceptions = @[ exception ]; - SentryMessage *msg = [SentryMessage alloc]; - msg.message = @"SomeOtherMessage"; - event.message = msg; - SentryEvent *result = options.beforeSend(event); - XCTAssertNotNil(result, @"Event with non-matching error should not be dropped"); -} - -- (void)testIgnoreErrorsDropsMatchingExactString -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"ignoreErrorsStr" : @[ @"ExactError" ] - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNotNil(options); - XCTAssertNil(error); - SentryEvent *event = [[SentryEvent alloc] init]; - SentryMessage *msg = [SentryMessage alloc]; - msg.message = @"ExactError"; - event.message = msg; - SentryEvent *result = options.beforeSend(event); - XCTAssertNil(result, @"Event with exactly matching string should be dropped"); -} - -- (void)testIgnoreErrorsRegexAndStringBothWork -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - @"ignoreErrorsStr" : @[ @"ExactError" ], - @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ], - - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNotNil(options); - XCTAssertNil(error); - // Test regex match - SentryEvent *event1 = [[SentryEvent alloc] init]; - SentryException *exception = [SentryException alloc]; - exception.value = @"IgnoreMe: This should be ignored"; - event1.exceptions = @[ exception ]; - SentryEvent *result1 = options.beforeSend(event1); - XCTAssertNil(result1, @"Event with matching regex should be dropped"); - // Test exact string match - SentryEvent *event2 = [[SentryEvent alloc] init]; - SentryMessage *msg = [SentryMessage alloc]; - msg.message = @"ExactError"; - event2.message = msg; - SentryEvent *result2 = options.beforeSend(event2); - XCTAssertNil(result2, @"Event with exactly matching string should be dropped"); - // Test non-matching - SentryEvent *event3 = [[SentryEvent alloc] init]; - SentryMessage *msg3 = [SentryMessage alloc]; - msg3.message = @"OtherError"; - event3.message = msg3; - SentryEvent *result3 = options.beforeSend(event3); - XCTAssertNotNil(result3, @"Event with non-matching error should not be dropped"); -} - -- (void)testBeforeSendFiltersOutUnhandledJSException -{ - RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNil(error); - - SentryEvent *event = [[SentryEvent alloc] init]; - SentryException *exception = [SentryException alloc]; - exception.type = @"Unhandled JS Exception"; - exception.value = @"Error: Test error"; - event.exceptions = @[ exception ]; - SentryEvent *result = options.beforeSend(event); - XCTAssertNil(result, @"Event with Unhandled JS Exception should be dropped"); + @"debugMetaImages" : @[ + @{ + @"uuid" : @"mockuuid", + @"debug_id" : @"mockdebugid", + @"type" : @"macho", + @"image_addr" : @"0x000000000001b669", + }, + ], + @"frames" : @[ + @{ + @"package" : @"testnameone", + @"in_app" : @NO, + @"platform" : @"cocoa", + @"instruction_addr" : @"0x000000000000007b", // 123 + @"image_addr" : @"0x000000000001b669", // 112233 + }, + @{ + @"package" : @"testnametwo", + @"in_app" : @NO, + @"platform" : @"cocoa", + @"instruction_addr" : @"0x00000000000001c8", // 456 + @"image_addr" : @"0x000000000001b669", // 445566 + }, + ], + }; + XCTAssertTrue([actual isEqualToDictionary:expected]); } -- (void)testBeforeSendFiltersOutJSErrorCppException +- (void)testFetchNativeStackFramesByInstructionsOnDeviceSymbolication { + [self prepareNativeFrameMocksWithLocalSymbolication:YES]; RNSentry *rnSentry = [[RNSentry alloc] init]; - NSError *error = nil; - NSMutableDictionary *mockedOptions = [@{ - @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", - } mutableCopy]; - mockedOptions = [rnSentry prepareOptions:mockedOptions]; - SentryOptions *options = [SentrySDKWrapper createOptionsWithDictionary:mockedOptions - error:&error]; - XCTAssertNotNil(options); - XCTAssertNil(error); - - // Test C++ exception with ExceptionsManager.reportException in value (actual format from New - // Architecture) The exception type is "C++ Exception" and the value contains the mangled name - // and error message - SentryEvent *event1 = [[SentryEvent alloc] init]; - SentryException *exception1 = [SentryException alloc]; - exception1.type = @"C++ Exception"; - exception1.value = @"N8facebook3jsi7JSErrorE: ExceptionsManager.reportException raised an " - @"exception: Unhandled JS Exception: Error: Test error"; - event1.exceptions = @[ exception1 ]; - SentryEvent *result1 = options.beforeSend(event1); - XCTAssertNil( - result1, @"Event with ExceptionsManager.reportException in value should be dropped"); - - // Test exception value containing ExceptionsManager.reportException (alternative format) - SentryEvent *event2 = [[SentryEvent alloc] init]; - SentryException *exception2 = [SentryException alloc]; - exception2.type = @"SomeOtherException"; - exception2.value = @"ExceptionsManager.reportException raised an exception: Unhandled JS " - @"Exception: Error: Test"; - event2.exceptions = @[ exception2 ]; - SentryEvent *result2 = options.beforeSend(event2); - XCTAssertNil( - result2, @"Event with ExceptionsManager.reportException in value should be dropped"); + NSDictionary *actual = [rnSentry fetchNativeStackFramesBy:@[ @123, @456 ] + symbolicate:sucessfulSymbolicate]; - // Test that legitimate C++ exceptions without ExceptionsManager.reportException are not - // filtered - SentryEvent *event3 = [[SentryEvent alloc] init]; - SentryException *exception3 = [SentryException alloc]; - exception3.type = @"C++ Exception"; - exception3.value = @"std::runtime_error: Some other C++ error occurred"; - event3.exceptions = @[ exception3 ]; - SentryEvent *result3 = options.beforeSend(event3); - XCTAssertNotNil(result3, - @"Legitimate C++ exception without ExceptionsManager.reportException should not be " - @"dropped"); + NSDictionary *expected = @{ + @"frames" : @[ + @{ + @"function" : @"symbolicatedname", + @"package" : @"testnameone", + @"in_app" : @NO, + @"platform" : @"cocoa", + @"symbol_addr" : @"0x000000000000007b", // 123 + @"instruction_addr" : @"0x000000000000007b", // 123 + @"image_addr" : @"0x000000000001b669", // 112233 + }, + @{ + @"function" : @"symbolicatedname", + @"package" : @"testnametwo", + @"in_app" : @NO, + @"platform" : @"cocoa", + @"symbol_addr" : @"0x000000000000007b", // 123 + @"instruction_addr" : @"0x00000000000001c8", // 456 + @"image_addr" : @"0x000000000001b669", // 445566 + }, + ], + }; + XCTAssertTrue([actual isEqualToDictionary:expected]); } - (void)testCreateUserWithGeoDataCreatesSentryGeoObject @@ -1398,4 +782,228 @@ - (void)testCaptureReplayWithReturnValueReturnsFalseWithoutInit } #endif +#pragma mark - RNSentryStart enableLogs Tests + +- (void)testStartCreateOptionsWithDictionaryEnableLogsEnabled +{ + NSError *error = nil; + + NSDictionary *_Nonnull mockedReactNativeDictionary = @{ + @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", + @"enableLogs" : @YES, + }; + SentryOptions *actualOptions = + [RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; + + XCTAssertNotNil(actualOptions, @"Did not create sentry options"); + XCTAssertNil(error, @"Should not pass no error"); + + BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue]; + XCTAssertTrue(enableLogs, @"enableLogs should be enabled"); +} + +- (void)testStartCreateOptionsWithDictionaryEnableLogsDisabled +{ + NSError *error = nil; + + NSDictionary *_Nonnull mockedReactNativeDictionary = @{ + @"dsn" : @"https://abcd@efgh.ingest.sentry.io/123456", + @"enableLogs" : @NO, + }; + SentryOptions *actualOptions = + [RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error]; + + XCTAssertNotNil(actualOptions, @"Did not create sentry options"); + XCTAssertNil(error, @"Should not pass no error"); + BOOL enableLogs = [[actualOptions valueForKey:@"enableLogs"] boolValue]; + XCTAssertFalse(enableLogs, @"enableLogs should be disabled"); +} + +#pragma mark - RNSentryStart ignoreErrors Tests + +- (void)testStartIgnoreErrorsDropsMatchingExceptionValue +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ] + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + XCTAssertNotNil(options); + XCTAssertNil(error); + SentryEvent *event = [[SentryEvent alloc] init]; + SentryException *exception = + [[SentryException alloc] initWithValue:@"IgnoreMe: This should be ignored" type:nil]; + event.exceptions = @[ exception ]; + SentryEvent *result = options.beforeSend(event); + XCTAssertNil(result, @"Event with matching exception.value should be dropped"); +} + +- (void)testStartIgnoreErrorsDropsMatchingEventMessage +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + @"ignoreErrorsStr" : @[ @"DropThisError" ] + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + XCTAssertNotNil(options); + XCTAssertNil(error); + SentryEvent *event = [[SentryEvent alloc] init]; + SentryMessage *msg = + [[SentryMessage alloc] initWithFormatted:@"DropThisError: should be dropped"]; + msg.message = @"DropThisError: should be dropped"; + event.message = msg; + SentryEvent *result = options.beforeSend(event); + XCTAssertNil(result, @"Event with matching event.message.formatted should be dropped"); +} + +- (void)testStartIgnoreErrorsDoesNotDropNonMatchingEvent +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ] + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + XCTAssertNotNil(options); + XCTAssertNil(error); + SentryEvent *event = [[SentryEvent alloc] init]; + SentryException *exception = + [[SentryException alloc] initWithValue:@"SomeOtherError: should not be ignored" type:nil]; + event.exceptions = @[ exception ]; + SentryMessage *msg = [[SentryMessage alloc] initWithFormatted:@"SomeOtherMessage"]; + msg.message = @"SomeOtherMessage"; + event.message = msg; + SentryEvent *result = options.beforeSend(event); + XCTAssertNotNil(result, @"Event with non-matching error should not be dropped"); +} + +- (void)testStartIgnoreErrorsDropsMatchingExactString +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + @"ignoreErrorsStr" : @[ @"ExactError" ] + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + XCTAssertNotNil(options); + XCTAssertNil(error); + SentryEvent *event = [[SentryEvent alloc] init]; + SentryMessage *msg = [[SentryMessage alloc] initWithFormatted:@"ExactError"]; + msg.message = @"ExactError"; + event.message = msg; + SentryEvent *result = options.beforeSend(event); + XCTAssertNil(result, @"Event with exactly matching string should be dropped"); +} + +- (void)testStartIgnoreErrorsRegexAndStringBothWork +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + @"ignoreErrorsStr" : @[ @"ExactError" ], + @"ignoreErrorsRegex" : @[ @"IgnoreMe.*" ], + + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + XCTAssertNotNil(options); + XCTAssertNil(error); + SentryEvent *event1 = [[SentryEvent alloc] init]; + SentryException *exception = + [[SentryException alloc] initWithValue:@"IgnoreMe: This should be ignored" type:nil]; + event1.exceptions = @[ exception ]; + SentryEvent *result1 = options.beforeSend(event1); + XCTAssertNil(result1, @"Event with matching regex should be dropped"); + SentryEvent *event2 = [[SentryEvent alloc] init]; + SentryMessage *msg = [[SentryMessage alloc] initWithFormatted:@"ExactError"]; + msg.message = @"ExactError"; + event2.message = msg; + SentryEvent *result2 = options.beforeSend(event2); + XCTAssertNil(result2, @"Event with exactly matching string should be dropped"); + SentryEvent *event3 = [[SentryEvent alloc] init]; + SentryMessage *msg3 = [[SentryMessage alloc] initWithFormatted:@"OtherError"]; + msg3.message = @"OtherError"; + event3.message = msg3; + SentryEvent *result3 = options.beforeSend(event3); + XCTAssertNotNil(result3, @"Event with non-matching error should not be dropped"); +} + +#pragma mark - RNSentryStart beforeSend duplicate filtering + +- (void)testStartBeforeSendFiltersOutUnhandledJSException +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + [RNSentryStart updateWithReactFinals:options]; + XCTAssertNotNil(options); + XCTAssertNil(error); + + SentryEvent *event = [[SentryEvent alloc] init]; + SentryException *exception = [[SentryException alloc] initWithValue:@"Error: Test error" + type:@"Unhandled JS Exception"]; + event.exceptions = @[ exception ]; + SentryEvent *result = options.beforeSend(event); + XCTAssertNil(result, @"Event with Unhandled JS Exception should be dropped"); +} + +- (void)testStartBeforeSendFiltersOutJSErrorCppException +{ + RNSentry *rnSentry = [[RNSentry alloc] init]; + NSError *error = nil; + NSMutableDictionary *mockedOptions = [@{ + @"dsn" : @"https://abc@def.ingest.sentry.io/1234567", + } mutableCopy]; + mockedOptions = [rnSentry prepareOptions:mockedOptions]; + SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedOptions error:&error]; + [RNSentryStart updateWithReactFinals:options]; + XCTAssertNotNil(options); + XCTAssertNil(error); + + SentryEvent *event1 = [[SentryEvent alloc] init]; + SentryException *exception1 = [[SentryException alloc] + initWithValue:@"N8facebook3jsi7JSErrorE: ExceptionsManager.reportException raised an " + @"exception: Unhandled JS Exception: Error: Test error" + type:@"C++ Exception"]; + event1.exceptions = @[ exception1 ]; + SentryEvent *result1 = options.beforeSend(event1); + XCTAssertNil( + result1, @"Event with ExceptionsManager.reportException in value should be dropped"); + + SentryEvent *event2 = [[SentryEvent alloc] init]; + SentryException *exception2 = [[SentryException alloc] + initWithValue:@"ExceptionsManager.reportException raised an exception: Unhandled JS " + @"Exception: Error: Test" + type:@"SomeOtherException"]; + event2.exceptions = @[ exception2 ]; + SentryEvent *result2 = options.beforeSend(event2); + XCTAssertNil( + result2, @"Event with ExceptionsManager.reportException in value should be dropped"); + + SentryEvent *event3 = [[SentryEvent alloc] init]; + SentryException *exception3 = + [[SentryException alloc] initWithValue:@"std::runtime_error: Some other C++ error occurred" + type:@"C++ Exception"]; + event3.exceptions = @[ exception3 ]; + SentryEvent *result3 = options.beforeSend(event3); + XCTAssertNotNil(result3, + @"Legitimate C++ exception without ExceptionsManager.reportException should not be " + @"dropped"); +} + @end diff --git a/packages/core/ios/SentrySDKWrapper.h b/packages/core/ios/SentrySDKWrapper.h index 22d184e79c..0126e47b64 100644 --- a/packages/core/ios/SentrySDKWrapper.h +++ b/packages/core/ios/SentrySDKWrapper.h @@ -1,6 +1,5 @@ #import -@class SentryOptions; @class SentryScope; @interface SentrySDKWrapper : NSObject @@ -13,19 +12,8 @@ + (BOOL)crashedLastRun; -+ (void)startWithOptions:(SentryOptions *)options; - -+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options - error:(NSError **)errorPointer; - -+ (void)setupWithDictionary:(NSDictionary *)options error:(NSError **)errorPointer; - + (BOOL)debug; + (NSString *)releaseName; -+ (BOOL)enableAutoSessionTracking; - -+ (BOOL)enableWatchdogTerminationTracking; - @end diff --git a/packages/core/ios/SentrySDKWrapper.m b/packages/core/ios/SentrySDKWrapper.m index d284d2a2d0..57458d291f 100644 --- a/packages/core/ios/SentrySDKWrapper.m +++ b/packages/core/ios/SentrySDKWrapper.m @@ -1,15 +1,8 @@ #import "SentrySDKWrapper.h" -#import "RNSentryExperimentalOptions.h" -#import "RNSentryVersion.h" @import Sentry; @implementation SentrySDKWrapper -+ (void)startWithOptions:(SentryOptions *)options -{ - [SentrySDK startWithOptions:options]; -} - + (void)crash { [SentrySDK crash]; @@ -30,118 +23,6 @@ + (void)configureScope:(void (^)(SentryScope *scope))callback [SentrySDK configureScope:callback]; } -+ (SentryOptions *)createOptionsWithDictionary:(NSDictionary *)options - error:(NSError *__autoreleasing *)errorPointer -{ - NSString *dsn = [self getURLFromDSN:[options valueForKey:@"dsn"]]; - SentryOptions *sentryOptions = [PrivateSentrySDKOnly optionsWithDictionary:options - didFailWithError:errorPointer]; - if (*errorPointer != nil) { - return nil; - } - - // Exclude Dev Server and Sentry Dsn request from Breadcrumbs - NSString *devServerUrl = [options valueForKey:@"devServerUrl"]; - sentryOptions.beforeBreadcrumb - = ^SentryBreadcrumb *_Nullable(SentryBreadcrumb *_Nonnull breadcrumb) - { - NSString *url = breadcrumb.data[@"url"] ?: @""; - - if ([@"http" isEqualToString:breadcrumb.type] - && ((dsn != nil && [url hasPrefix:dsn]) - || (devServerUrl != nil && [url hasPrefix:devServerUrl]))) { - return nil; - } - return breadcrumb; - }; - - if ([options valueForKey:@"enableNativeCrashHandling"] != nil) { - BOOL enableNativeCrashHandling = [options[@"enableNativeCrashHandling"] boolValue]; - - if (!enableNativeCrashHandling) { - sentryOptions.enableCrashHandler = NO; - } - } - - // Set spotlight option - if ([options valueForKey:@"spotlight"] != nil) { - id spotlightValue = [options valueForKey:@"spotlight"]; - if ([spotlightValue isKindOfClass:[NSString class]]) { - NSLog(@"Using Spotlight on address: %@", spotlightValue); - sentryOptions.enableSpotlight = true; - sentryOptions.spotlightUrl = spotlightValue; - } else if ([spotlightValue isKindOfClass:[NSNumber class]]) { - sentryOptions.enableSpotlight = [spotlightValue boolValue]; - id defaultSpotlightUrl = [options valueForKey:@"defaultSidecarUrl"]; - if (defaultSpotlightUrl != nil) { - sentryOptions.spotlightUrl = defaultSpotlightUrl; - } - } - } - - if ([options valueForKey:@"enableLogs"] != nil) { - id enableLogsValue = [options valueForKey:@"enableLogs"]; - if ([enableLogsValue isKindOfClass:[NSNumber class]]) { - [RNSentryExperimentalOptions setEnableLogs:[enableLogsValue boolValue] - sentryOptions:sentryOptions]; - } - } - - // Enable the App start and Frames tracking measurements - if ([options valueForKey:@"enableAutoPerformanceTracing"] != nil) { - BOOL enableAutoPerformanceTracing = [options[@"enableAutoPerformanceTracing"] boolValue]; - PrivateSentrySDKOnly.appStartMeasurementHybridSDKMode = enableAutoPerformanceTracing; -#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST - PrivateSentrySDKOnly.framesTrackingMeasurementHybridSDKMode = enableAutoPerformanceTracing; -#endif - } - - // Failed requests can only be enabled in one SDK to avoid duplicates - sentryOptions.enableCaptureFailedRequests = NO; - - NSDictionary *experiments = options[@"_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 - sentryOptions:sentryOptions]; - } - } - - return sentryOptions; -} - -+ (NSString *_Nullable)getURLFromDSN:(NSString *)dsn -{ - NSURL *url = [NSURL URLWithString:dsn]; - if (!url) { - return nil; - } - return [NSString stringWithFormat:@"%@://%@", url.scheme, url.host]; -} - -+ (void)setupWithDictionary:(NSDictionary *_Nonnull)options - error:(NSError *_Nonnull *_Nonnull)errorPointer -{ - SentryOptions *sentryOptions = [self createOptionsWithDictionary:options error:errorPointer]; - if (!options) { - return; - } - - NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString]; - [PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion]; - [PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME - version:REACT_NATIVE_SDK_PACKAGE_VERSION]; - - [SentrySDKWrapper startWithOptions:sentryOptions]; -} - + (BOOL)debug { return PrivateSentrySDKOnly.options.debug; @@ -152,14 +33,4 @@ + (NSString *)releaseName return PrivateSentrySDKOnly.options.releaseName; } -+ (BOOL)enableAutoSessionTracking -{ - return PrivateSentrySDKOnly.options.enableAutoSessionTracking; -} - -+ (BOOL)enableWatchdogTerminationTracking -{ - return PrivateSentrySDKOnly.options.enableWatchdogTerminationTracking; -} - @end