Skip to content

Commit

Permalink
Merge 97bce9c into 65f3705
Browse files Browse the repository at this point in the history
  • Loading branch information
antonis authored Feb 3, 2025
2 parents 65f3705 + 97bce9c commit 13aaa0b
Showing 1 changed file with 11 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
import com.facebook.react.common.JavascriptException;
import com.facebook.react.modules.core.DeviceEventManagerModule;
import io.sentry.Breadcrumb;
import io.sentry.HubAdapter;
import io.sentry.ILogger;
import io.sentry.IScope;
import io.sentry.ISentryExecutorService;
import io.sentry.ISerializer;
import io.sentry.Integration;
import io.sentry.ScopesAdapter;
import io.sentry.Sentry;
import io.sentry.SentryDate;
import io.sentry.SentryDateProvider;
Expand Down Expand Up @@ -85,6 +85,7 @@
import java.util.List;
import java.util.Map;
import java.util.Properties;
import java.util.Set;
import java.util.concurrent.CountDownLatch;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
Expand Down Expand Up @@ -505,7 +506,7 @@ public void fetchNativeFrames(Promise promise) {
}

public void captureReplay(boolean isHardCrash, Promise promise) {
Sentry.getCurrentHub().getOptions().getReplayController().captureReplay(isHardCrash);
Sentry.getCurrentScopes().getOptions().getReplayController().captureReplay(isHardCrash);
promise.resolve(getCurrentReplayId());
}

Expand Down Expand Up @@ -601,7 +602,7 @@ public void fetchViewHierarchy(Promise promise) {
return;
}

ISerializer serializer = HubAdapter.getInstance().getOptions().getSerializer();
ISerializer serializer = ScopesAdapter.getInstance().getOptions().getSerializer();
final @Nullable byte[] bytes =
JsonSerializationUtils.bytesFrom(serializer, logger, viewHierarchy);
if (bytes == null) {
Expand Down Expand Up @@ -655,10 +656,6 @@ public void setUser(final ReadableMap userKeys, final ReadableMap userDataKeys)
if (userKeys.hasKey("ip_address")) {
userInstance.setIpAddress(userKeys.getString("ip_address"));
}

if (userKeys.hasKey("segment")) {
userInstance.setSegment(userKeys.getString("segment"));
}
}

if (userDataKeys != null) {
Expand Down Expand Up @@ -807,8 +804,7 @@ private void initializeAndroidProfiler() {
(int) SECONDS.toMicros(1) / profilingTracesHz,
new SentryFrameMetricsCollector(reactApplicationContext, logger, buildInfo),
executorService,
logger,
buildInfo);
logger);
}

public WritableMap startProfiling(boolean platformProfilers) {
Expand All @@ -832,7 +828,7 @@ public WritableMap startProfiling(boolean platformProfilers) {
}

public WritableMap stopProfiling() {
final boolean isDebug = HubAdapter.getInstance().getOptions().isDebug();
final boolean isDebug = ScopesAdapter.getInstance().getOptions().isDebug();
final WritableMap result = new WritableNativeMap();
File output = null;
try {
Expand Down Expand Up @@ -918,7 +914,7 @@ private String readStringFromFile(File path) throws IOException {
}

public void fetchNativeDeviceContexts(Promise promise) {
final @NotNull SentryOptions options = HubAdapter.getInstance().getOptions();
final @NotNull SentryOptions options = ScopesAdapter.getInstance().getOptions();
final @Nullable Context context = this.getReactApplicationContext().getApplicationContext();
final @Nullable IScope currentScope = InternalSentrySdk.getCurrentScope();
fetchNativeDeviceContexts(promise, options, context, currentScope);
Expand Down Expand Up @@ -955,7 +951,8 @@ protected void fetchNativeDeviceContexts(
}

public void fetchNativeSdkInfo(Promise promise) {
final @Nullable SdkVersion sdkVersion = HubAdapter.getInstance().getOptions().getSdkVersion();
final @Nullable SdkVersion sdkVersion =
ScopesAdapter.getInstance().getOptions().getSdkVersion();
if (sdkVersion == null) {
promise.resolve(null);
} else {
Expand Down Expand Up @@ -1001,14 +998,14 @@ private void addPackages(SentryEvent event, SdkVersion sdk) {
if (eventSdk != null
&& "sentry.javascript.react-native".equals(eventSdk.getName())
&& sdk != null) {
List<SentryPackage> sentryPackages = sdk.getPackages();
Set<SentryPackage> sentryPackages = sdk.getPackageSet();
if (sentryPackages != null) {
for (SentryPackage sentryPackage : sentryPackages) {
eventSdk.addPackage(sentryPackage.getName(), sentryPackage.getVersion());
}
}

List<String> integrations = sdk.getIntegrations();
Set<String> integrations = sdk.getIntegrationSet();
if (integrations != null) {
for (String integration : integrations) {
eventSdk.addIntegration(integration);
Expand Down

0 comments on commit 13aaa0b

Please sign in to comment.