Skip to content

Commit 8b86336

Browse files
feat: Add RN SDK package to sdk.packages for Cocoa (#4381)
Co-authored-by: Antonis Lilis <[email protected]>
1 parent c71ea72 commit 8b86336

File tree

5 files changed

+18
-4
lines changed

5 files changed

+18
-4
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
### Changes
1616

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))
18+
- Add RN SDK package to `sdk.packages` for Cocoa ([#4381](https://github.com/getsentry/sentry-react-native/pull/4381))
1819

1920
### Dependencies
2021

packages/core/ios/RNSentry.mm

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@
4949
# import "RNSentryRNSScreen.h"
5050
#endif
5151

52+
#import "RNSentryVersion.h"
53+
5254
@interface
5355
SentrySDK (RNSentry)
5456

@@ -60,8 +62,6 @@ + (void)storeEnvelope:(SentryEnvelope *)envelope;
6062

6163
static bool hasFetchedAppStart;
6264

63-
static NSString *const nativeSdkName = @"sentry.cocoa.react-native";
64-
6565
@implementation RNSentry {
6666
bool sentHybridSdkDidBecomeActive;
6767
bool hasListeners;
@@ -93,7 +93,9 @@ + (BOOL)requiresMainQueueSetup
9393
}
9494

9595
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
96-
[PrivateSentrySDKOnly setSdkName:nativeSdkName andVersionString:sdkVersion];
96+
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
97+
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
98+
version:REACT_NATIVE_SDK_PACKAGE_VERSION];
9799

98100
[SentrySDK startWithOptions:sentryOptions];
99101

@@ -236,7 +238,7 @@ - (void)setEventOriginTag:(SentryEvent *)event
236238

237239
// If the event is from react native, it gets set
238240
// there and we do not handle it here.
239-
if ([sdkName isEqual:nativeSdkName]) {
241+
if ([sdkName isEqual:NATIVE_SDK_NAME]) {
240242
[self setEventEnvironmentTag:event origin:@"ios" environment:@"native"];
241243
}
242244
}

packages/core/ios/RNSentryVersion.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#import <Foundation/Foundation.h>
2+
3+
extern NSString *const NATIVE_SDK_NAME;
4+
extern NSString *const REACT_NATIVE_SDK_PACKAGE_NAME;
5+
extern NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION;

packages/core/ios/RNSentryVersion.m

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
#import "RNSentryVersion.h"
2+
3+
NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
4+
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
5+
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.4.0";

scripts/version-bump.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ replace({
77
files: [
88
'packages/core/src/js/version.ts',
99
'packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java',
10+
'packages/core/ios/RNSentryVersion.m',
1011
],
1112
from: /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g,
1213
to: pjson.version,

0 commit comments

Comments
 (0)