Skip to content

Commit

Permalink
feat: Add RN SDK package to sdk.packages for Cocoa (#4381)
Browse files Browse the repository at this point in the history
Co-authored-by: Antonis Lilis <[email protected]>
  • Loading branch information
krystofwoldrich and antonis authored Jan 13, 2025
1 parent c71ea72 commit 8b86336
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
### Changes

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

### Dependencies

Expand Down
10 changes: 6 additions & 4 deletions packages/core/ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@
# import "RNSentryRNSScreen.h"
#endif

#import "RNSentryVersion.h"

@interface
SentrySDK (RNSentry)

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

static bool hasFetchedAppStart;

static NSString *const nativeSdkName = @"sentry.cocoa.react-native";

@implementation RNSentry {
bool sentHybridSdkDidBecomeActive;
bool hasListeners;
Expand Down Expand Up @@ -93,7 +93,9 @@ + (BOOL)requiresMainQueueSetup
}

NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
[PrivateSentrySDKOnly setSdkName:nativeSdkName andVersionString:sdkVersion];
[PrivateSentrySDKOnly setSdkName:NATIVE_SDK_NAME andVersionString:sdkVersion];
[PrivateSentrySDKOnly addSdkPackage:REACT_NATIVE_SDK_PACKAGE_NAME
version:REACT_NATIVE_SDK_PACKAGE_VERSION];

[SentrySDK startWithOptions:sentryOptions];

Expand Down Expand Up @@ -236,7 +238,7 @@ - (void)setEventOriginTag:(SentryEvent *)event

// If the event is from react native, it gets set
// there and we do not handle it here.
if ([sdkName isEqual:nativeSdkName]) {
if ([sdkName isEqual:NATIVE_SDK_NAME]) {
[self setEventEnvironmentTag:event origin:@"ios" environment:@"native"];
}
}
Expand Down
5 changes: 5 additions & 0 deletions packages/core/ios/RNSentryVersion.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import <Foundation/Foundation.h>

extern NSString *const NATIVE_SDK_NAME;
extern NSString *const REACT_NATIVE_SDK_PACKAGE_NAME;
extern NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION;
5 changes: 5 additions & 0 deletions packages/core/ios/RNSentryVersion.m
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#import "RNSentryVersion.h"

NSString *const NATIVE_SDK_NAME = @"sentry.cocoa.react-native";
NSString *const REACT_NATIVE_SDK_PACKAGE_NAME = @"npm:@sentry/react-native";
NSString *const REACT_NATIVE_SDK_PACKAGE_VERSION = @"6.4.0";
1 change: 1 addition & 0 deletions scripts/version-bump.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ replace({
files: [
'packages/core/src/js/version.ts',
'packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java',
'packages/core/ios/RNSentryVersion.m',
],
from: /\d+\.\d+.\d+(?:-\w+(?:\.\w+)?)?/g,
to: pjson.version,
Expand Down

0 comments on commit 8b86336

Please sign in to comment.