Skip to content

Commit

Permalink
Move SDK name and version to react defaults
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis committed Feb 3, 2025
1 parent 821fef9 commit 43b26db
Showing 1 changed file with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -82,20 +82,6 @@ static void getSentryAndroidOptions(
@NotNull ReadableMap rnOptions,
@Nullable Activity currentActivity,
ILogger logger) {
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
if (sdkVersion == null) {
sdkVersion = new SdkVersion(RNSentryVersion.ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
} else {
sdkVersion.setName(RNSentryVersion.ANDROID_SDK_NAME);
}
sdkVersion.addPackage(
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_NAME,
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);

options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
options.setNativeSdkName(RNSentryVersion.NATIVE_SDK_NAME);
options.setSdkVersion(sdkVersion);

if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
options.setDebug(true);
}
Expand Down Expand Up @@ -216,6 +202,20 @@ static void getSentryAndroidOptions(
* users during manual native initialization.
*/
static void updateWithReactDefaults(@NotNull SentryAndroidOptions options) {
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
if (sdkVersion == null) {
sdkVersion = new SdkVersion(RNSentryVersion.ANDROID_SDK_NAME, BuildConfig.VERSION_NAME);
} else {
sdkVersion.setName(RNSentryVersion.ANDROID_SDK_NAME);
}
sdkVersion.addPackage(
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_NAME,
RNSentryVersion.REACT_NATIVE_SDK_PACKAGE_VERSION);

options.setSentryClientName(sdkVersion.getName() + "/" + sdkVersion.getVersion());
options.setNativeSdkName(RNSentryVersion.NATIVE_SDK_NAME);
options.setSdkVersion(sdkVersion);

// Tracing is only enabled in JS to avoid duplicate navigation spans
options.setTracesSampleRate(null);
options.setTracesSampler(null);
Expand Down

0 comments on commit 43b26db

Please sign in to comment.