File tree Expand file tree Collapse file tree 4 files changed +28
-0
lines changed
android/src/main/java/io/sentry/react
sample-new-architecture/src Expand file tree Collapse file tree 4 files changed +28
-0
lines changed Original file line number Diff line number Diff line change 11# Changelog
22
3+ ## Unreleased
4+
5+ ### Breaking changes
6+
7+ - Events captured by Native SDKs are reporting as RN SDK ([ #2814 ] ( https://github.com/getsentry/sentry-react-native/pull/2814 ) )
8+
39## 5.0.0-beta.2
410
511### Features
Original file line number Diff line number Diff line change 1010import android .util .SparseIntArray ;
1111
1212import androidx .annotation .Nullable ;
13+ import androidx .annotation .NonNull ;
1314import androidx .core .app .FrameMetricsAggregator ;
1415
1516import com .facebook .react .bridge .Arguments ;
@@ -102,6 +103,17 @@ Activity getCurrentActivity() {
102103
103104 public void initNativeSdk (final ReadableMap rnOptions , Promise promise ) {
104105 SentryAndroid .init (this .getReactApplicationContext (), options -> {
106+ if (rnOptions .hasKey ("_metadata" )) {
107+ @ Nullable final ReadableMap metadata = rnOptions .getMap ("_metadata" );
108+ @ Nullable final ReadableMap sdkMap = metadata != null ? metadata .getMap ("sdk" ) : null ;
109+ @ Nullable final String sdkMapName = sdkMap != null ? sdkMap .getString ("name" ) : null ;
110+ @ Nullable final String sdkMapVersion = sdkMap != null ? sdkMap .getString ("version" ) : null ;
111+ if (sdkMapName != null && sdkMapVersion != null ) {
112+ @ NonNull final SdkVersion sdkVersion = new SdkVersion (sdkMapName , sdkMapVersion );
113+ options .setSentryClientName (sdkMapName + "/" + sdkMapVersion );
114+ options .setSdkVersion (sdkVersion );
115+ }
116+ }
105117 if (rnOptions .hasKey ("debug" ) && rnOptions .getBoolean ("debug" )) {
106118 options .setDebug (true );
107119 }
Original file line number Diff line number Diff line change @@ -56,6 +56,15 @@ + (BOOL)requiresMainQueueSetup {
5656 return ;
5757 }
5858
59+ if ([options[@" _metadata" ] isKindOfClass: [NSDictionary class ]]
60+ && [options[@" _metadata" ][@" sdk" ] isKindOfClass: [NSDictionary class ]]
61+ && [options[@" _metadata" ][@" sdk" ][@" name" ] isKindOfClass: [NSString class ]]
62+ && [options[@" _metadata" ][@" sdk" ][@" version" ] isKindOfClass: [NSString class ]]) {
63+ [PrivateSentrySDKOnly
64+ setSdkName: options[@" _metadata" ][@" sdk" ][@" name" ]
65+ andVersionString: options[@" _metadata" ][@" sdk" ][@" version" ]];
66+ }
67+
5968 [SentrySDK startWithOptions: sentryOptions];
6069
6170#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
Original file line number Diff line number Diff line change @@ -59,6 +59,7 @@ Sentry.init({
5959 // This will capture ALL TRACES and likely use up all your quota
6060 tracesSampleRate : 1.0 ,
6161 attachStacktrace : true ,
62+ attachScreenshot : true ,
6263 // Sets the `release` and `dist` on Sentry events. Make sure this matches EXACTLY with the values on your sourcemaps
6364 // otherwise they will not work.
6465 // release: '[email protected] +1',
You can’t perform that action at this time.
0 commit comments