29
29
import com .facebook .react .common .JavascriptException ;
30
30
import com .facebook .react .modules .core .DeviceEventManagerModule ;
31
31
import io .sentry .Breadcrumb ;
32
- import io .sentry .HubAdapter ;
33
32
import io .sentry .ILogger ;
34
33
import io .sentry .IScope ;
35
34
import io .sentry .ISentryExecutorService ;
36
35
import io .sentry .ISerializer ;
37
36
import io .sentry .Integration ;
37
+ import io .sentry .ScopesAdapter ;
38
38
import io .sentry .Sentry ;
39
39
import io .sentry .SentryDate ;
40
40
import io .sentry .SentryDateProvider ;
85
85
import java .util .List ;
86
86
import java .util .Map ;
87
87
import java .util .Properties ;
88
+ import java .util .Set ;
88
89
import java .util .concurrent .CountDownLatch ;
89
90
import org .jetbrains .annotations .NotNull ;
90
91
import org .jetbrains .annotations .Nullable ;
@@ -505,7 +506,7 @@ public void fetchNativeFrames(Promise promise) {
505
506
}
506
507
507
508
public void captureReplay (boolean isHardCrash , Promise promise ) {
508
- Sentry .getCurrentHub ().getOptions ().getReplayController ().captureReplay (isHardCrash );
509
+ Sentry .getCurrentScopes ().getOptions ().getReplayController ().captureReplay (isHardCrash );
509
510
promise .resolve (getCurrentReplayId ());
510
511
}
511
512
@@ -601,7 +602,7 @@ public void fetchViewHierarchy(Promise promise) {
601
602
return ;
602
603
}
603
604
604
- ISerializer serializer = HubAdapter .getInstance ().getOptions ().getSerializer ();
605
+ ISerializer serializer = ScopesAdapter .getInstance ().getOptions ().getSerializer ();
605
606
final @ Nullable byte [] bytes =
606
607
JsonSerializationUtils .bytesFrom (serializer , logger , viewHierarchy );
607
608
if (bytes == null ) {
@@ -655,10 +656,6 @@ public void setUser(final ReadableMap userKeys, final ReadableMap userDataKeys)
655
656
if (userKeys .hasKey ("ip_address" )) {
656
657
userInstance .setIpAddress (userKeys .getString ("ip_address" ));
657
658
}
658
-
659
- if (userKeys .hasKey ("segment" )) {
660
- userInstance .setSegment (userKeys .getString ("segment" ));
661
- }
662
659
}
663
660
664
661
if (userDataKeys != null ) {
@@ -807,8 +804,7 @@ private void initializeAndroidProfiler() {
807
804
(int ) SECONDS .toMicros (1 ) / profilingTracesHz ,
808
805
new SentryFrameMetricsCollector (reactApplicationContext , logger , buildInfo ),
809
806
executorService ,
810
- logger ,
811
- buildInfo );
807
+ logger );
812
808
}
813
809
814
810
public WritableMap startProfiling (boolean platformProfilers ) {
@@ -832,7 +828,7 @@ public WritableMap startProfiling(boolean platformProfilers) {
832
828
}
833
829
834
830
public WritableMap stopProfiling () {
835
- final boolean isDebug = HubAdapter .getInstance ().getOptions ().isDebug ();
831
+ final boolean isDebug = ScopesAdapter .getInstance ().getOptions ().isDebug ();
836
832
final WritableMap result = new WritableNativeMap ();
837
833
File output = null ;
838
834
try {
@@ -918,7 +914,7 @@ private String readStringFromFile(File path) throws IOException {
918
914
}
919
915
920
916
public void fetchNativeDeviceContexts (Promise promise ) {
921
- final @ NotNull SentryOptions options = HubAdapter .getInstance ().getOptions ();
917
+ final @ NotNull SentryOptions options = ScopesAdapter .getInstance ().getOptions ();
922
918
final @ Nullable Context context = this .getReactApplicationContext ().getApplicationContext ();
923
919
final @ Nullable IScope currentScope = InternalSentrySdk .getCurrentScope ();
924
920
fetchNativeDeviceContexts (promise , options , context , currentScope );
@@ -955,7 +951,8 @@ protected void fetchNativeDeviceContexts(
955
951
}
956
952
957
953
public void fetchNativeSdkInfo (Promise promise ) {
958
- final @ Nullable SdkVersion sdkVersion = HubAdapter .getInstance ().getOptions ().getSdkVersion ();
954
+ final @ Nullable SdkVersion sdkVersion =
955
+ ScopesAdapter .getInstance ().getOptions ().getSdkVersion ();
959
956
if (sdkVersion == null ) {
960
957
promise .resolve (null );
961
958
} else {
@@ -1001,14 +998,14 @@ private void addPackages(SentryEvent event, SdkVersion sdk) {
1001
998
if (eventSdk != null
1002
999
&& "sentry.javascript.react-native" .equals (eventSdk .getName ())
1003
1000
&& sdk != null ) {
1004
- List <SentryPackage > sentryPackages = sdk .getPackages ();
1001
+ Set <SentryPackage > sentryPackages = sdk .getPackageSet ();
1005
1002
if (sentryPackages != null ) {
1006
1003
for (SentryPackage sentryPackage : sentryPackages ) {
1007
1004
eventSdk .addPackage (sentryPackage .getName (), sentryPackage .getVersion ());
1008
1005
}
1009
1006
}
1010
1007
1011
- List <String > integrations = sdk .getIntegrations ();
1008
+ Set <String > integrations = sdk .getIntegrationSet ();
1012
1009
if (integrations != null ) {
1013
1010
for (String integration : integrations ) {
1014
1011
eventSdk .addIntegration (integration );
0 commit comments