Skip to content

Commit aca58c3

Browse files
Merge d7270b1 into 8b86336
2 parents 8b86336 + d7270b1 commit aca58c3

File tree

8 files changed

+279
-209
lines changed

8 files changed

+279
-209
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@
1717
- Rename `navigation.processing` span to more expressive `Navigation dispatch to screen A mounted/navigation cancelled` ([#4423](https://github.com/getsentry/sentry-react-native/pull/4423))
1818
- Add RN SDK package to `sdk.packages` for Cocoa ([#4381](https://github.com/getsentry/sentry-react-native/pull/4381))
1919

20+
### Internal
21+
22+
- Initialize `RNSentryTimeToDisplay` during native module `init` on iOS ([#4443](https://github.com/getsentry/sentry-react-native/pull/4443))
23+
- Extract iOS native initialization to standalone structures ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
24+
2025
### Dependencies
2126

2227
- Bump CLI from v2.39.1 to v2.40.0 ([#4412](https://github.com/getsentry/sentry-react-native/pull/4412))

packages/core/RNSentryCocoaTester/RNSentryCocoaTester.xcodeproj/project.pbxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,8 @@
2525
332D33482CDBDC7300547D76 /* RNSentry.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentry.h; path = ../ios/RNSentry.h; sourceTree = SOURCE_ROOT; };
2626
332D33492CDCC8E100547D76 /* RNSentryTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryTests.h; sourceTree = "<group>"; };
2727
332D334A2CDCC8EB00547D76 /* RNSentryCocoaTesterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryCocoaTesterTests-Bridging-Header.h"; sourceTree = "<group>"; };
28+
333B58A82D35BA93000F8D04 /* RNSentryStart.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = RNSentryStart.h; path = ../ios/RNSentryStart.h; sourceTree = SOURCE_ROOT; };
29+
333B58A92D35BB2D000F8D04 /* RNSentryStart+Test.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; name = "RNSentryStart+Test.h"; path = "RNSentryCocoaTesterTests/RNSentryStart+Test.h"; sourceTree = SOURCE_ROOT; };
2830
336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RNSentryReplayBreadcrumbConverterTests.swift; sourceTree = "<group>"; };
2931
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayBreadcrumbConverter.h; path = ../ios/RNSentryReplayBreadcrumbConverter.h; sourceTree = "<group>"; };
3032
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryBreadcrumbTests.swift; sourceTree = "<group>"; };
@@ -116,6 +118,8 @@
116118
33AFE0122B8F319000AAB120 /* RNSentry */ = {
117119
isa = PBXGroup;
118120
children = (
121+
333B58A92D35BB2D000F8D04 /* RNSentryStart+Test.h */,
122+
333B58A82D35BA93000F8D04 /* RNSentryStart.h */,
119123
3380C6C02CDEC56B0018B9B6 /* Replay */,
120124
332D33482CDBDC7300547D76 /* RNSentry.h */,
121125
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */,
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
#import "RNSentryStart.h"
2+
3+
@interface
4+
RNSentryStart (Test)
5+
6+
+ (void)setEventOriginTag:(SentryEvent *)event;
7+
8+
@end

packages/core/RNSentryCocoaTester/RNSentryCocoaTesterTests/RNSentryTests.mm

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
#import "RNSentryTests.h"
2+
#import "RNSentryStart+Test.h"
23
#import <OCMock/OCMock.h>
34
#import <RNSentry/RNSentry.h>
45
#import <Sentry/SentryDebugImageProvider+HybridSDKs.h>
@@ -25,8 +26,8 @@ - (void)testCreateOptionsWithDictionaryRemovesPerformanceProperties
2526
, @"enableTracing" : @YES,
2627
}
2728
;
28-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
29-
error:&error];
29+
SentryOptions *actualOptions =
30+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
3031

3132
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
3233
XCTAssertNil(error, @"Should not pass no error");
@@ -46,8 +47,8 @@ - (void)testCaptureFailedRequestsIsDisabled
4647
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
4748
@"dsn" : @"https://[email protected]/123456",
4849
};
49-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
50-
error:&error];
50+
SentryOptions *actualOptions =
51+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
5152

5253
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
5354
XCTAssertNil(error, @"Should not pass no error");
@@ -62,8 +63,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDefault
6263
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
6364
@"dsn" : @"https://[email protected]/123456",
6465
};
65-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
66-
error:&error];
66+
SentryOptions *actualOptions =
67+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
6768
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
6869
XCTAssertNil(error, @"Should not pass no error");
6970
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], true,
@@ -78,8 +79,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDefault
7879
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
7980
@"dsn" : @"https://[email protected]/123456",
8081
};
81-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
82-
error:&error];
82+
SentryOptions *actualOptions =
83+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
8384
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
8485
XCTAssertNil(error, @"Should not pass no error");
8586
XCTAssertEqual(
@@ -95,8 +96,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingEnabled
9596
@"dsn" : @"https://[email protected]/123456",
9697
@"enableNativeCrashHandling" : @YES,
9798
};
98-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
99-
error:&error];
99+
SentryOptions *actualOptions =
100+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
100101
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
101102
XCTAssertNil(error, @"Should not pass no error");
102103
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], true,
@@ -112,8 +113,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingEnabled
112113
@"dsn" : @"https://[email protected]/123456",
113114
@"enableAutoPerformanceTracing" : @YES,
114115
};
115-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
116-
error:&error];
116+
SentryOptions *actualOptions =
117+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
117118
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
118119
XCTAssertNil(error, @"Should not pass no error");
119120
XCTAssertEqual(
@@ -129,8 +130,8 @@ - (void)testCreateOptionsWithDictionaryNativeCrashHandlingDisabled
129130
@"dsn" : @"https://[email protected]/123456",
130131
@"enableNativeCrashHandling" : @NO,
131132
};
132-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
133-
error:&error];
133+
SentryOptions *actualOptions =
134+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
134135
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
135136
XCTAssertNil(error, @"Should not pass no error");
136137
XCTAssertEqual([actualOptions.integrations containsObject:@"SentryCrashIntegration"], false,
@@ -146,8 +147,8 @@ - (void)testCreateOptionsWithDictionaryAutoPerformanceTracingDisabled
146147
@"dsn" : @"https://[email protected]/123456",
147148
@"enableAutoPerformanceTracing" : @NO,
148149
};
149-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
150-
error:&error];
150+
SentryOptions *actualOptions =
151+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
151152
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
152153
XCTAssertNil(error, @"Should not pass no error");
153154
XCTAssertEqual(actualOptions.enableAutoPerformanceTracing, false,
@@ -164,8 +165,8 @@ - (void)testCreateOptionsWithDictionarySpotlightEnabled
164165
@"spotlight" : @YES,
165166
@"defaultSidecarUrl" : @"http://localhost:8969/teststream",
166167
};
167-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
168-
error:&error];
168+
SentryOptions *actualOptions =
169+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
169170
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
170171
XCTAssertNil(error, @"Should not pass no error");
171172
XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight");
@@ -182,8 +183,8 @@ - (void)testCreateOptionsWithDictionarySpotlightOne
182183
@"spotlight" : @1,
183184
@"defaultSidecarUrl" : @"http://localhost:8969/teststream",
184185
};
185-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
186-
error:&error];
186+
SentryOptions *actualOptions =
187+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
187188
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
188189
XCTAssertNil(error, @"Should not pass no error");
189190
XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight");
@@ -199,8 +200,8 @@ - (void)testCreateOptionsWithDictionarySpotlightUrl
199200
@"dsn" : @"https://[email protected]/123456",
200201
@"spotlight" : @"http://localhost:8969/teststream",
201202
};
202-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
203-
error:&error];
203+
SentryOptions *actualOptions =
204+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
204205
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
205206
XCTAssertNil(error, @"Should not pass no error");
206207
XCTAssertTrue(actualOptions.enableSpotlight, @"Did not enable spotlight");
@@ -216,8 +217,8 @@ - (void)testCreateOptionsWithDictionarySpotlightDisabled
216217
@"dsn" : @"https://[email protected]/123456",
217218
@"spotlight" : @NO,
218219
};
219-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
220-
error:&error];
220+
SentryOptions *actualOptions =
221+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
221222
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
222223
XCTAssertNil(error, @"Should not pass no error");
223224
XCTAssertFalse(actualOptions.enableSpotlight, @"Did not disable spotlight");
@@ -232,8 +233,8 @@ - (void)testCreateOptionsWithDictionarySpotlightZero
232233
@"dsn" : @"https://[email protected]/123456",
233234
@"spotlight" : @0,
234235
};
235-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
236-
error:&error];
236+
SentryOptions *actualOptions =
237+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
237238
XCTAssertNotNil(actualOptions, @"Did not create sentry options");
238239
XCTAssertNil(error, @"Should not pass no error");
239240
XCTAssertFalse(actualOptions.enableSpotlight, @"Did not disable spotlight");
@@ -247,8 +248,8 @@ - (void)testPassesErrorOnWrongDsn
247248
NSDictionary *_Nonnull mockedReactNativeDictionary = @{
248249
@"dsn" : @"not_a_valid_dsn",
249250
};
250-
SentryOptions *actualOptions = [rnSentry createOptionsWithDictionary:mockedReactNativeDictionary
251-
error:&error];
251+
SentryOptions *actualOptions =
252+
[RNSentryStart createOptionsWithDictionary:mockedReactNativeDictionary error:&error];
252253

253254
XCTAssertNil(actualOptions, @"Created invalid sentry options");
254255
XCTAssertNotNil(error, @"Did not created error on invalid dsn");
@@ -263,7 +264,8 @@ - (void)testBeforeBreadcrumbsCallbackFiltersOutSentryDsnRequestBreadcrumbs
263264
@"dsn" : @"https://[email protected]/1234567",
264265
@"devServerUrl" : @"http://localhost:8081"
265266
};
266-
SentryOptions *options = [rnSentry createOptionsWithDictionary:mockedDictionary error:&error];
267+
SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedDictionary
268+
error:&error];
267269

268270
SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init];
269271
breadcrumb.type = @"http";
@@ -283,7 +285,8 @@ - (void)testBeforeBreadcrumbsCallbackFiltersOutDevServerRequestBreadcrumbs
283285

284286
NSDictionary *_Nonnull mockedDictionary =
285287
@{ @"dsn" : @"https://[email protected]/1234567", @"devServerUrl" : mockDevServer };
286-
SentryOptions *options = [rnSentry createOptionsWithDictionary:mockedDictionary error:&error];
288+
SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedDictionary
289+
error:&error];
287290

288291
SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init];
289292
breadcrumb.type = @"http";
@@ -303,7 +306,8 @@ - (void)testBeforeBreadcrumbsCallbackDoesNotFiltersOutNonDevServerOrDsnRequestBr
303306
@"dsn" : @"https://[email protected]/1234567",
304307
@"devServerUrl" : @"http://localhost:8081"
305308
};
306-
SentryOptions *options = [rnSentry createOptionsWithDictionary:mockedDictionary error:&error];
309+
SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedDictionary
310+
error:&error];
307311

308312
SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init];
309313
breadcrumb.type = @"http";
@@ -322,7 +326,8 @@ - (void)testBeforeBreadcrumbsCallbackKeepsBreadcrumbWhenDevServerUrlIsNotPassedA
322326
NSDictionary *_Nonnull mockedDictionary = @{ // dsn is always validated in SentryOptions initialization
323327
@"dsn" : @"https://[email protected]/1234567"
324328
};
325-
SentryOptions *options = [rnSentry createOptionsWithDictionary:mockedDictionary error:&error];
329+
SentryOptions *options = [RNSentryStart createOptionsWithDictionary:mockedDictionary
330+
error:&error];
326331

327332
SentryBreadcrumb *breadcrumb = [[SentryBreadcrumb alloc] init];
328333
breadcrumb.type = @"http";
@@ -341,7 +346,7 @@ - (void)testEventFromSentryCocoaReactNativeHasOriginAndEnvironmentTags
341346
@"name" : @"sentry.cocoa.react-native",
342347
};
343348

344-
[rnSentry setEventOriginTag:testEvent];
349+
[RNSentryStart setEventOriginTag:testEvent];
345350

346351
XCTAssertEqual(testEvent.tags[@"event.origin"], @"ios");
347352
XCTAssertEqual(testEvent.tags[@"event.environment"], @"native");
@@ -359,7 +364,7 @@ - (void)testEventFromSentryReactNativeOriginAndEnvironmentTagsAreOverwritten
359364
@"event.environment" : @"testEventEnvironmentTag",
360365
};
361366

362-
[rnSentry setEventOriginTag:testEvent];
367+
[RNSentryStart setEventOriginTag:testEvent];
363368

364369
XCTAssertEqual(testEvent.tags[@"event.origin"], @"ios");
365370
XCTAssertEqual(testEvent.tags[@"event.environment"], @"native");

packages/core/ios/RNSentry.h

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,11 +20,6 @@ SentrySDK (Private)
2020

2121
@interface RNSentry : RCTEventEmitter <RCTBridgeModule>
2222

23-
- (SentryOptions *_Nullable)createOptionsWithDictionary:(NSDictionary *_Nonnull)options
24-
error:(NSError *_Nullable *_Nonnull)errorPointer;
25-
26-
- (void)setEventOriginTag:(SentryEvent *)event;
27-
2823
- (NSDictionary *_Nonnull)fetchNativeStackFramesBy:(NSArray<NSNumber *> *)instructionsAddr
2924
symbolicate:(SymbolicateCallbackType)symbolicate;
3025

0 commit comments

Comments
 (0)