2929import com .facebook .react .common .JavascriptException ;
3030import com .facebook .react .modules .core .DeviceEventManagerModule ;
3131import io .sentry .Breadcrumb ;
32- import io .sentry .HubAdapter ;
3332import io .sentry .ILogger ;
3433import io .sentry .IScope ;
3534import io .sentry .ISentryExecutorService ;
3635import io .sentry .ISerializer ;
3736import io .sentry .Integration ;
37+ import io .sentry .ScopesAdapter ;
3838import io .sentry .Sentry ;
3939import io .sentry .SentryDate ;
4040import io .sentry .SentryDateProvider ;
8585import java .util .List ;
8686import java .util .Map ;
8787import java .util .Properties ;
88+ import java .util .Set ;
8889import java .util .concurrent .CountDownLatch ;
8990import org .jetbrains .annotations .NotNull ;
9091import org .jetbrains .annotations .Nullable ;
@@ -505,7 +506,7 @@ public void fetchNativeFrames(Promise promise) {
505506 }
506507
507508 public void captureReplay (boolean isHardCrash , Promise promise ) {
508- Sentry .getCurrentHub ().getOptions ().getReplayController ().captureReplay (isHardCrash );
509+ Sentry .getCurrentScopes ().getOptions ().getReplayController ().captureReplay (isHardCrash );
509510 promise .resolve (getCurrentReplayId ());
510511 }
511512
@@ -601,7 +602,7 @@ public void fetchViewHierarchy(Promise promise) {
601602 return ;
602603 }
603604
604- ISerializer serializer = HubAdapter .getInstance ().getOptions ().getSerializer ();
605+ ISerializer serializer = ScopesAdapter .getInstance ().getOptions ().getSerializer ();
605606 final @ Nullable byte [] bytes =
606607 JsonSerializationUtils .bytesFrom (serializer , logger , viewHierarchy );
607608 if (bytes == null ) {
@@ -655,10 +656,6 @@ public void setUser(final ReadableMap userKeys, final ReadableMap userDataKeys)
655656 if (userKeys .hasKey ("ip_address" )) {
656657 userInstance .setIpAddress (userKeys .getString ("ip_address" ));
657658 }
658-
659- if (userKeys .hasKey ("segment" )) {
660- userInstance .setSegment (userKeys .getString ("segment" ));
661- }
662659 }
663660
664661 if (userDataKeys != null ) {
@@ -807,8 +804,7 @@ private void initializeAndroidProfiler() {
807804 (int ) SECONDS .toMicros (1 ) / profilingTracesHz ,
808805 new SentryFrameMetricsCollector (reactApplicationContext , logger , buildInfo ),
809806 executorService ,
810- logger ,
811- buildInfo );
807+ logger );
812808 }
813809
814810 public WritableMap startProfiling (boolean platformProfilers ) {
@@ -832,7 +828,7 @@ public WritableMap startProfiling(boolean platformProfilers) {
832828 }
833829
834830 public WritableMap stopProfiling () {
835- final boolean isDebug = HubAdapter .getInstance ().getOptions ().isDebug ();
831+ final boolean isDebug = ScopesAdapter .getInstance ().getOptions ().isDebug ();
836832 final WritableMap result = new WritableNativeMap ();
837833 File output = null ;
838834 try {
@@ -918,7 +914,7 @@ private String readStringFromFile(File path) throws IOException {
918914 }
919915
920916 public void fetchNativeDeviceContexts (Promise promise ) {
921- final @ NotNull SentryOptions options = HubAdapter .getInstance ().getOptions ();
917+ final @ NotNull SentryOptions options = ScopesAdapter .getInstance ().getOptions ();
922918 final @ Nullable Context context = this .getReactApplicationContext ().getApplicationContext ();
923919 final @ Nullable IScope currentScope = InternalSentrySdk .getCurrentScope ();
924920 fetchNativeDeviceContexts (promise , options , context , currentScope );
@@ -955,7 +951,8 @@ protected void fetchNativeDeviceContexts(
955951 }
956952
957953 public void fetchNativeSdkInfo (Promise promise ) {
958- final @ Nullable SdkVersion sdkVersion = HubAdapter .getInstance ().getOptions ().getSdkVersion ();
954+ final @ Nullable SdkVersion sdkVersion =
955+ ScopesAdapter .getInstance ().getOptions ().getSdkVersion ();
959956 if (sdkVersion == null ) {
960957 promise .resolve (null );
961958 } else {
@@ -1001,14 +998,14 @@ private void addPackages(SentryEvent event, SdkVersion sdk) {
1001998 if (eventSdk != null
1002999 && "sentry.javascript.react-native" .equals (eventSdk .getName ())
10031000 && sdk != null ) {
1004- List <SentryPackage > sentryPackages = sdk .getPackages ();
1001+ Set <SentryPackage > sentryPackages = sdk .getPackageSet ();
10051002 if (sentryPackages != null ) {
10061003 for (SentryPackage sentryPackage : sentryPackages ) {
10071004 eventSdk .addPackage (sentryPackage .getName (), sentryPackage .getVersion ());
10081005 }
10091006 }
10101007
1011- List <String > integrations = sdk .getIntegrations ();
1008+ Set <String > integrations = sdk .getIntegrationSet ();
10121009 if (integrations != null ) {
10131010 for (String integration : integrations ) {
10141011 eventSdk .addIntegration (integration );
0 commit comments