|
1 | 1 | package io.sentry; |
2 | 2 |
|
| 3 | +import com.facebook.react.ReactApplication; |
3 | 4 | import com.facebook.react.bridge.Arguments; |
4 | 5 | import com.facebook.react.bridge.Promise; |
5 | 6 | import com.facebook.react.bridge.ReactApplicationContext; |
6 | 7 | import com.facebook.react.bridge.ReactContextBaseJavaModule; |
7 | 8 | import com.facebook.react.bridge.ReactMethod; |
8 | | -import com.facebook.react.bridge.ReadableArray; |
9 | 9 | import com.facebook.react.bridge.ReadableMap; |
10 | 10 | import com.facebook.react.bridge.ReadableNativeArray; |
11 | 11 | import com.facebook.react.bridge.ReadableNativeMap; |
12 | 12 | import com.facebook.react.bridge.WritableMap; |
13 | 13 |
|
14 | 14 | import java.util.HashMap; |
15 | | -import java.util.List; |
16 | 15 | import java.util.Map; |
17 | 16 | import java.util.logging.Level; |
18 | 17 | import java.util.logging.Logger; |
|
30 | 29 | public class RNSentryModule extends ReactContextBaseJavaModule { |
31 | 30 |
|
32 | 31 | private final ReactApplicationContext reactContext; |
| 32 | + private final ReactApplication reactApplication; |
| 33 | + |
33 | 34 | final static Logger logger = Logger.getLogger("react-native-sentry"); |
34 | 35 | private ReadableMap extra; |
35 | 36 | private ReadableMap tags; |
36 | 37 |
|
37 | | - public RNSentryModule(ReactApplicationContext reactContext) { |
| 38 | + public RNSentryModule(ReactApplicationContext reactContext, ReactApplication reactApplication) { |
38 | 39 | super(reactContext); |
39 | 40 | this.reactContext = reactContext; |
| 41 | + this.reactApplication = reactApplication; |
| 42 | + } |
| 43 | + |
| 44 | + public ReactApplication getReactApplication() { |
| 45 | + return reactApplication; |
40 | 46 | } |
41 | 47 |
|
42 | 48 | @Override |
@@ -158,7 +164,7 @@ public void captureEvent(ReadableMap event) { |
158 | 164 | Sentry.capture(builtEvent); |
159 | 165 | } else { |
160 | 166 | RNSentryExceptionsManagerModule.lastReceivedException = event; |
161 | | - if (RNSentryPackage.useDeveloperSupport == true) { |
| 167 | + if (this.getReactApplication().getReactNativeHost().getUseDeveloperSupport() == true) { |
162 | 168 | ReadableNativeArray exceptionValues = ((ReadableNativeArray)RNSentryExceptionsManagerModule.lastReceivedException.getMap("exception").getArray("values")); |
163 | 169 | ReadableNativeMap exception = exceptionValues.getMap(0); |
164 | 170 | ReadableNativeMap stacktrace = exception.getMap("stacktrace"); |
|
0 commit comments