Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(native): Add react-native postfix to native SDKs #2814

Merged
merged 7 commits into from
Apr 11, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions android/src/main/java/io/sentry/react/RNSentryModuleImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import android.util.SparseIntArray;

import androidx.annotation.Nullable;
import androidx.annotation.NonNull;
import androidx.core.app.FrameMetricsAggregator;

import com.facebook.react.bridge.Arguments;
Expand Down Expand Up @@ -51,6 +52,7 @@
import io.sentry.android.core.AndroidLogger;
import io.sentry.android.core.AnrIntegration;
import io.sentry.android.core.AppStartState;
import io.sentry.android.core.BuildConfig;
import io.sentry.android.core.BuildInfoProvider;
import io.sentry.android.core.CurrentActivityHolder;
import io.sentry.android.core.NdkIntegration;
Expand Down Expand Up @@ -102,6 +104,17 @@ Activity getCurrentActivity() {

public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
SentryAndroid.init(this.getReactApplicationContext(), options -> {
@NonNull final String sdkName = "sentry.java.android.react-native";
@Nullable SdkVersion sdkVersion = options.getSdkVersion();
if (sdkVersion == null) {
sdkVersion = new SdkVersion(sdkName, BuildConfig.VERSION_NAME);
} else {
sdkVersion.setName(sdkName);
}

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

if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
options.setDebug(true);
}
Expand Down
4 changes: 4 additions & 0 deletions ios/RNSentry.mm
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@ + (BOOL)requiresMainQueueSetup {
return;
}

NSString *sdkName = @"sentry.cocoa.react-native";
NSString *sdkVersion = [PrivateSentrySDKOnly getSdkVersionString];
[PrivateSentrySDKOnly setSdkName: sdkName andVersionString: sdkVersion];

[SentrySDK startWithOptions:sentryOptions];

#if TARGET_OS_IPHONE || TARGET_OS_MACCATALYST
Expand Down