Skip to content

Commit 43b26db

Browse files
committed
Move SDK name and version to react defaults
1 parent 821fef9 commit 43b26db

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java

+14-14
Original file line numberDiff line numberDiff line change
@@ -82,20 +82,6 @@ static void getSentryAndroidOptions(
8282
@NotNull ReadableMap rnOptions,
8383
@Nullable Activity currentActivity,
8484
ILogger logger) {
85-
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
86-
if (sdkVersion == null) {
87-
sdkVersion = new SdkVersion(RNSentryVersion.ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
88-
} else {
89-
sdkVersion.setName(RNSentryVersion.ANDROID_SDK_NAME);
90-
}
91-
sdkVersion.addPackage(
92-
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_NAME,
93-
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);
94-
95-
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
96-
options.setNativeSdkName(RNSentryVersion.NATIVE_SDK_NAME);
97-
options.setSdkVersion(sdkVersion);
98-
9985
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
10086
options.setDebug(true);
10187
}
@@ -216,6 +202,20 @@ static void getSentryAndroidOptions(
216202
* users during manual native initialization.
217203
*/
218204
static void updateWithReactDefaults(@NotNull SentryAndroidOptions options) {
205+
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
206+
if (sdkVersion == null) {
207+
sdkVersion = new SdkVersion(RNSentryVersion.ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
208+
} else {
209+
sdkVersion.setName(RNSentryVersion.ANDROID_SDK_NAME);
210+
}
211+
sdkVersion.addPackage(
212+
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_NAME,
213+
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);
214+
215+
options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
216+
options.setNativeSdkName(RNSentryVersion.NATIVE_SDK_NAME);
217+
options.setSdkVersion(sdkVersion);
218+
219219
// Tracing is only enabled in JS to avoid duplicate navigation spans
220220
options.setTracesSampleRate(null);
221221
options.setTracesSampler(null);

0 commit comments

Comments
 (0)