@sentry/react-native 4.11.0 → 5.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +114 -0
- package/RNSentry.podspec +20 -3
- package/android/build.gradle +19 -1
- package/android/src/main/java/io/sentry/react/{RNSentryModule.java → RNSentryModuleImpl.java} +15 -30
- package/android/src/main/java/io/sentry/react/RNSentryPackage.java +35 -19
- package/android/src/newarch/java/io/sentry/react/RNSentryModule.java +119 -0
- package/android/src/oldarch/java/io/sentry/react/RNSentryModule.java +119 -0
- package/dist/js/NativeRNSentry.d.ts +52 -0
- package/dist/js/NativeRNSentry.d.ts.map +1 -0
- package/dist/js/NativeRNSentry.js +4 -0
- package/dist/js/NativeRNSentry.js.map +1 -0
- package/dist/js/integrations/debugsymbolicator.d.ts +9 -0
- package/dist/js/integrations/debugsymbolicator.d.ts.map +1 -1
- package/dist/js/integrations/debugsymbolicator.js +0 -2
- package/dist/js/integrations/debugsymbolicator.js.map +1 -1
- package/dist/js/integrations/index.d.ts +1 -0
- package/dist/js/integrations/index.d.ts.map +1 -1
- package/dist/js/integrations/index.js +1 -0
- package/dist/js/integrations/index.js.map +1 -1
- package/dist/js/integrations/reactnativeinfo.d.ts +23 -0
- package/dist/js/integrations/reactnativeinfo.d.ts.map +1 -0
- package/dist/js/integrations/reactnativeinfo.js +43 -0
- package/dist/js/integrations/reactnativeinfo.js.map +1 -0
- package/dist/js/sdk.d.ts.map +1 -1
- package/dist/js/sdk.js +2 -5
- package/dist/js/sdk.js.map +1 -1
- package/dist/js/tracing/nativeframes.js.map +1 -1
- package/dist/js/tracing/reactnativetracing.d.ts +14 -5
- package/dist/js/tracing/reactnativetracing.d.ts.map +1 -1
- package/dist/js/tracing/reactnativetracing.js +9 -6
- package/dist/js/tracing/reactnativetracing.js.map +1 -1
- package/dist/js/tracing/utils.d.ts +1 -2
- package/dist/js/tracing/utils.d.ts.map +1 -1
- package/dist/js/tracing/utils.js +2 -10
- package/dist/js/tracing/utils.js.map +1 -1
- package/dist/js/utils/environment.d.ts +7 -0
- package/dist/js/utils/environment.d.ts.map +1 -0
- package/dist/js/utils/environment.js +14 -0
- package/dist/js/utils/environment.js.map +1 -0
- package/dist/js/utils/worldwide.d.ts +2 -0
- package/dist/js/utils/worldwide.d.ts.map +1 -1
- package/dist/js/utils/worldwide.js.map +1 -1
- package/dist/js/version.d.ts +1 -1
- package/dist/js/version.d.ts.map +1 -1
- package/dist/js/version.js +1 -1
- package/dist/js/version.js.map +1 -1
- package/dist/js/wrapper.d.ts +2 -2
- package/dist/js/wrapper.d.ts.map +1 -1
- package/dist/js/wrapper.js +5 -2
- package/dist/js/wrapper.js.map +1 -1
- package/ios/{RNSentry.m → RNSentry.mm} +15 -2
- package/package.json +18 -16
- package/react-native.config.js +3 -10
- package/sample-new-architecture/react-native.config.js +10 -0
- package/src/js/NativeRNSentry.ts +66 -0
- package/dist/js/definitions.d.ts +0 -57
- package/dist/js/definitions.d.ts.map +0 -1
- package/dist/js/definitions.js +0 -1
- package/dist/js/definitions.js.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 5.0.0-alpha.10
|
|
4
|
+
|
|
5
|
+
- Latest changes from 4.11.0
|
|
6
|
+
|
|
7
|
+
### Dependencies
|
|
8
|
+
|
|
9
|
+
- Bump CLI from v1.74.4 to v2.10.0 ([#2669](https://github.com/getsentry/sentry-react-native/pull/2669))
|
|
10
|
+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#2100)
|
|
11
|
+
- [diff](https://github.com/getsentry/sentry-cli/compare/1.74.4...2.10.0)
|
|
12
|
+
|
|
3
13
|
## 4.11.0
|
|
4
14
|
|
|
5
15
|
### Features
|
|
@@ -23,6 +33,14 @@
|
|
|
23
33
|
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#691)
|
|
24
34
|
- [diff](https://github.com/getsentry/sentry-java/compare/6.8.0...6.9.1)
|
|
25
35
|
|
|
36
|
+
## 5.0.0-alpha.9
|
|
37
|
+
|
|
38
|
+
- Latest changes from 4.10.0
|
|
39
|
+
|
|
40
|
+
### Fixes
|
|
41
|
+
|
|
42
|
+
- Add missing source Spec for RNSentry Codegen. ([#2639](https://github.com/getsentry/sentry-react-native/pull/2639))
|
|
43
|
+
|
|
26
44
|
## 4.10.0
|
|
27
45
|
|
|
28
46
|
### Features
|
|
@@ -36,6 +54,10 @@
|
|
|
36
54
|
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7211)
|
|
37
55
|
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.20.1...7.21.1)
|
|
38
56
|
|
|
57
|
+
## 5.0.0-alpha.8
|
|
58
|
+
|
|
59
|
+
- Latest changes from 4.9.0
|
|
60
|
+
|
|
39
61
|
## 4.9.0
|
|
40
62
|
|
|
41
63
|
### Features
|
|
@@ -74,6 +96,30 @@
|
|
|
74
96
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7290)
|
|
75
97
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.28.0...7.29.0)
|
|
76
98
|
|
|
99
|
+
## 5.0.0-alpha.7
|
|
100
|
+
|
|
101
|
+
- Latest changes from 4.7.1
|
|
102
|
+
|
|
103
|
+
### Fixes
|
|
104
|
+
|
|
105
|
+
- Remove hardcoded Folly version ([#2558](https://github.com/getsentry/sentry-react-native/pull/2558))
|
|
106
|
+
|
|
107
|
+
### Features
|
|
108
|
+
|
|
109
|
+
- Send react native js engine, turbo module, fabric flags and component stack in Event contexts ([#2552](https://github.com/getsentry/sentry-react-native/pull/2552))
|
|
110
|
+
|
|
111
|
+
### Dependencies
|
|
112
|
+
|
|
113
|
+
- Bump CLI from v1.74.4 to v2.7.0 ([#2457](https://github.com/getsentry/sentry-react-native/pull/2457))
|
|
114
|
+
- [changelog](https://github.com/getsentry/sentry-cli/blob/master/CHANGELOG.md#270)
|
|
115
|
+
- [diff](https://github.com/getsentry/sentry-cli/compare/1.74.4...2.7.0)
|
|
116
|
+
- Bump Android SDK from v6.5.0 to v6.6.0 ([#2572](https://github.com/getsentry/sentry-react-native/pull/2572))
|
|
117
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#660)
|
|
118
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.5.0...6.6.0)
|
|
119
|
+
- Bump Cocoa SDK from v7.28.0 to v7.29.0 ([#2571](https://github.com/getsentry/sentry-react-native/pull/2571))
|
|
120
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7290)
|
|
121
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.28.0...7.29.0)
|
|
122
|
+
|
|
77
123
|
## 4.7.1
|
|
78
124
|
|
|
79
125
|
### Fixes
|
|
@@ -95,6 +141,28 @@
|
|
|
95
141
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7280)
|
|
96
142
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.27.1...7.28.0)
|
|
97
143
|
|
|
144
|
+
## 5.0.0-alpha.6
|
|
145
|
+
|
|
146
|
+
- Latest changes from 4.6.1
|
|
147
|
+
|
|
148
|
+
### Features
|
|
149
|
+
|
|
150
|
+
- Add initial support for the RN New Architecture, backwards compatible RNSentry Turbo Module ([#2522](https://github.com/getsentry/sentry-react-native/pull/2522))
|
|
151
|
+
|
|
152
|
+
### Breaking changes
|
|
153
|
+
|
|
154
|
+
- New ReactNativeTracingOptions idleTimeoutMs and finalTimeoutMs replacing idleTimeout and maxTransactionDuration respectively ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))
|
|
155
|
+
- iOS min target 12.4, Android API min 21, min React Native version 0.70 ([#2522](https://github.com/getsentry/sentry-react-native/pull/2522))
|
|
156
|
+
|
|
157
|
+
### Dependencies
|
|
158
|
+
|
|
159
|
+
- Bump Android SDK from v6.4.3 to v6.5.0 ([#2535](https://github.com/getsentry/sentry-react-native/pull/2535))
|
|
160
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#650)
|
|
161
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.3...6.5.0)
|
|
162
|
+
- Bump JavaScript SDK from v7.14.2 to v7.15.0 ([#2536](https://github.com/getsentry/sentry-react-native/pull/2536))
|
|
163
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7150)
|
|
164
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.14.2...7.15.0)
|
|
165
|
+
|
|
98
166
|
## 4.6.1
|
|
99
167
|
|
|
100
168
|
### Fixes
|
|
@@ -115,6 +183,24 @@
|
|
|
115
183
|
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#643)
|
|
116
184
|
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.2...6.4.3)
|
|
117
185
|
|
|
186
|
+
## 5.0.0-alpha.5
|
|
187
|
+
|
|
188
|
+
### Fixes
|
|
189
|
+
|
|
190
|
+
- Make `configureScope` callback safe [#2510](https://github.com/getsentry/sentry-react-native/pull/2510)
|
|
191
|
+
|
|
192
|
+
### Dependencies
|
|
193
|
+
|
|
194
|
+
- Bump JavaScript SDK from v7.14.0 to v7.14.1 ([#2511](https://github.com/getsentry/sentry-react-native/pull/2511))
|
|
195
|
+
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7141)
|
|
196
|
+
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.14.0...7.14.1)
|
|
197
|
+
- Bump Cocoa SDK from v7.27.0 to v7.27.1 ([#2521](https://github.com/getsentry/sentry-react-native/pull/2521))
|
|
198
|
+
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7271)
|
|
199
|
+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.27.0...7.27.1)
|
|
200
|
+
- Bump Android SDK from v6.4.2 to v6.4.3 ([#2520](https://github.com/getsentry/sentry-react-native/pull/2520))
|
|
201
|
+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#643)
|
|
202
|
+
- [diff](https://github.com/getsentry/sentry-java/compare/6.4.2...6.4.3)
|
|
203
|
+
|
|
118
204
|
## 4.6.0
|
|
119
205
|
|
|
120
206
|
### Fixes
|
|
@@ -139,6 +225,14 @@
|
|
|
139
225
|
- [changelog](https://github.com/getsentry/sentry-javascript/blob/master/CHANGELOG.md#7140)
|
|
140
226
|
- [diff](https://github.com/getsentry/sentry-javascript/compare/7.13.0...7.14.0)
|
|
141
227
|
|
|
228
|
+
## 5.0.0-alpha.4
|
|
229
|
+
|
|
230
|
+
- Latest changes from 4.5.0
|
|
231
|
+
|
|
232
|
+
### Breaking changes
|
|
233
|
+
|
|
234
|
+
- New ReactNativeTracingOptions idleTimeoutMs and finalTimeoutMs replacing idleTimeout and maxTransactionDuration respectively ([#2481](https://github.com/getsentry/sentry-react-native/pull/2481))
|
|
235
|
+
|
|
142
236
|
## 4.5.0
|
|
143
237
|
|
|
144
238
|
### Features
|
|
@@ -179,6 +273,16 @@
|
|
|
179
273
|
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/master/CHANGELOG.md#7251)
|
|
180
274
|
- [diff](https://github.com/getsentry/sentry-cocoa/compare/7.24.1...7.25.1)
|
|
181
275
|
|
|
276
|
+
## 5.0.0-alpha.3
|
|
277
|
+
|
|
278
|
+
- Latest changes from 4.3.x
|
|
279
|
+
|
|
280
|
+
### Dependencies
|
|
281
|
+
|
|
282
|
+
- Bump Wizard from v2.0.0 to v2.2.0 ([#2460](https://github.com/getsentry/sentry-react-native/pull/2460))
|
|
283
|
+
- [changelog](https://github.com/getsentry/sentry-wizard/blob/master/CHANGELOG.md#v220)
|
|
284
|
+
- [diff](https://github.com/getsentry/sentry-wizard/compare/v2.0.0...v2.2.0)
|
|
285
|
+
|
|
182
286
|
## 4.3.0
|
|
183
287
|
|
|
184
288
|
### Features
|
|
@@ -203,6 +307,16 @@
|
|
|
203
307
|
|
|
204
308
|
- ReactNativeTracing wrongly marks transactions as deadline_exceeded when it reaches the idleTimeout ([#2427](https://github.com/getsentry/sentry-react-native/pull/2427))
|
|
205
309
|
|
|
310
|
+
## 5.0.0-alpha.2
|
|
311
|
+
|
|
312
|
+
- Latest changes from 4.2.x
|
|
313
|
+
|
|
314
|
+
## 5.0.0-alpha.1
|
|
315
|
+
|
|
316
|
+
### Fixes
|
|
317
|
+
|
|
318
|
+
- Auto linking for RN >= 0.69 ([#2332](https://github.com/getsentry/sentry-react-native/pull/2332))
|
|
319
|
+
|
|
206
320
|
## 4.2.3
|
|
207
321
|
|
|
208
322
|
### Fixes
|
package/RNSentry.podspec
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
require 'json'
|
|
2
2
|
version = JSON.parse(File.read('package.json'))["version"]
|
|
3
3
|
|
|
4
|
+
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
|
5
|
+
|
|
4
6
|
Pod::Spec.new do |s|
|
|
5
7
|
s.name = 'RNSentry'
|
|
6
8
|
s.version = version
|
|
@@ -10,15 +12,30 @@ Pod::Spec.new do |s|
|
|
|
10
12
|
s.homepage = "https://github.com/getsentry/sentry-react-native"
|
|
11
13
|
s.source = { :git => 'https://github.com/getsentry/sentry-react-native.git', :tag => "#{s.version}"}
|
|
12
14
|
|
|
13
|
-
s.ios.deployment_target = "
|
|
15
|
+
s.ios.deployment_target = "12.4"
|
|
14
16
|
s.osx.deployment_target = "10.10"
|
|
15
|
-
s.tvos.deployment_target = "
|
|
17
|
+
s.tvos.deployment_target = "12.4"
|
|
16
18
|
|
|
17
19
|
s.preserve_paths = '*.js'
|
|
18
20
|
|
|
19
21
|
s.dependency 'React-Core'
|
|
20
22
|
s.dependency 'Sentry/HybridSDK', '7.31.2'
|
|
21
23
|
|
|
22
|
-
s.source_files = 'ios/RNSentry.{h,
|
|
24
|
+
s.source_files = 'ios/RNSentry.{h,mm}'
|
|
23
25
|
s.public_header_files = 'ios/RNSentry.h'
|
|
26
|
+
|
|
27
|
+
# This guard prevent to install the dependencies when we run `pod install` in the old architecture.
|
|
28
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
29
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
30
|
+
s.pod_target_xcconfig = {
|
|
31
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
32
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
s.dependency "React-Codegen"
|
|
36
|
+
s.dependency "RCT-Folly"
|
|
37
|
+
s.dependency "RCTRequired"
|
|
38
|
+
s.dependency "RCTTypeSafety"
|
|
39
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
40
|
+
end
|
|
24
41
|
end
|
package/android/build.gradle
CHANGED
|
@@ -2,13 +2,20 @@ def safeExtGet(prop, fallback) {
|
|
|
2
2
|
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
|
|
3
3
|
}
|
|
4
4
|
|
|
5
|
+
def isNewArchitectureEnabled() {
|
|
6
|
+
return project.hasProperty("newArchEnabled") && project.newArchEnabled == "true"
|
|
7
|
+
}
|
|
8
|
+
|
|
5
9
|
apply plugin: 'com.android.library'
|
|
10
|
+
if (isNewArchitectureEnabled()) {
|
|
11
|
+
apply plugin: 'com.facebook.react'
|
|
12
|
+
}
|
|
6
13
|
|
|
7
14
|
android {
|
|
8
15
|
compileSdkVersion safeExtGet('compileSdkVersion', 31)
|
|
9
16
|
|
|
10
17
|
defaultConfig {
|
|
11
|
-
minSdkVersion safeExtGet('minSdkVersion',
|
|
18
|
+
minSdkVersion safeExtGet('minSdkVersion', 21)
|
|
12
19
|
targetSdkVersion safeExtGet('targetSdkVersion', 31)
|
|
13
20
|
versionCode 1
|
|
14
21
|
versionName "1.0"
|
|
@@ -19,6 +26,17 @@ android {
|
|
|
19
26
|
sourceCompatibility JavaVersion.VERSION_1_8
|
|
20
27
|
targetCompatibility JavaVersion.VERSION_1_8
|
|
21
28
|
}
|
|
29
|
+
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
sourceSets {
|
|
33
|
+
main {
|
|
34
|
+
if (isNewArchitectureEnabled()) {
|
|
35
|
+
java.srcDirs += ['src/newarch']
|
|
36
|
+
} else {
|
|
37
|
+
java.srcDirs += ['src/oldarch']
|
|
38
|
+
}
|
|
39
|
+
}
|
|
22
40
|
}
|
|
23
41
|
}
|
|
24
42
|
|
package/android/src/main/java/io/sentry/react/{RNSentryModule.java → RNSentryModuleImpl.java}
RENAMED
|
@@ -9,13 +9,12 @@ import android.content.pm.PackageManager;
|
|
|
9
9
|
import android.content.res.AssetManager;
|
|
10
10
|
import android.util.SparseIntArray;
|
|
11
11
|
|
|
12
|
+
import androidx.annotation.Nullable;
|
|
12
13
|
import androidx.core.app.FrameMetricsAggregator;
|
|
13
14
|
|
|
14
15
|
import com.facebook.react.bridge.Arguments;
|
|
15
16
|
import com.facebook.react.bridge.Promise;
|
|
16
17
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
17
|
-
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
18
|
-
import com.facebook.react.bridge.ReactMethod;
|
|
19
18
|
import com.facebook.react.bridge.ReadableArray;
|
|
20
19
|
import com.facebook.react.bridge.ReadableMap;
|
|
21
20
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
@@ -58,8 +57,7 @@ import io.sentry.protocol.SentryException;
|
|
|
58
57
|
import io.sentry.protocol.SentryPackage;
|
|
59
58
|
import io.sentry.protocol.User;
|
|
60
59
|
|
|
61
|
-
|
|
62
|
-
public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
60
|
+
public class RNSentryModuleImpl {
|
|
63
61
|
|
|
64
62
|
public static final String NAME = "RNSentry";
|
|
65
63
|
|
|
@@ -68,6 +66,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
68
66
|
private static final String modulesPath = "modules.json";
|
|
69
67
|
private static final Charset UTF_8 = Charset.forName("UTF-8");
|
|
70
68
|
|
|
69
|
+
private final ReactApplicationContext reactApplicationContext;
|
|
71
70
|
private final PackageInfo packageInfo;
|
|
72
71
|
private FrameMetricsAggregator frameMetricsAggregator = null;
|
|
73
72
|
private boolean androidXAvailable;
|
|
@@ -80,18 +79,20 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
80
79
|
// 16ms (slower than 60fps) to constitute slow frames.
|
|
81
80
|
private static final int SLOW_FRAME_THRESHOLD = 16;
|
|
82
81
|
|
|
83
|
-
public
|
|
84
|
-
|
|
85
|
-
|
|
82
|
+
public RNSentryModuleImpl(ReactApplicationContext reactApplicationContext) {
|
|
83
|
+
packageInfo = getPackageInfo(reactApplicationContext);
|
|
84
|
+
this.reactApplicationContext = reactApplicationContext;
|
|
86
85
|
}
|
|
87
86
|
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
return NAME;
|
|
87
|
+
private ReactApplicationContext getReactApplicationContext() {
|
|
88
|
+
return this.reactApplicationContext;
|
|
91
89
|
}
|
|
92
90
|
|
|
91
|
+
private @Nullable
|
|
92
|
+
Activity getCurrentActivity() {
|
|
93
|
+
return this.reactApplicationContext.getCurrentActivity();
|
|
94
|
+
}
|
|
93
95
|
|
|
94
|
-
@ReactMethod
|
|
95
96
|
public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
|
|
96
97
|
SentryAndroid.init(this.getReactApplicationContext(), options -> {
|
|
97
98
|
if (rnOptions.hasKey("debug") && rnOptions.getBoolean("debug")) {
|
|
@@ -193,21 +194,19 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
193
194
|
promise.resolve(true);
|
|
194
195
|
}
|
|
195
196
|
|
|
196
|
-
@ReactMethod
|
|
197
197
|
public void crash() {
|
|
198
198
|
throw new RuntimeException("TEST - Sentry Client Crash (only works in release mode)");
|
|
199
199
|
}
|
|
200
200
|
|
|
201
|
-
@ReactMethod
|
|
202
201
|
public void fetchModules(Promise promise) {
|
|
203
202
|
final AssetManager assets = this.getReactApplicationContext().getResources().getAssets();
|
|
204
203
|
try (final InputStream stream =
|
|
205
|
-
new BufferedInputStream(assets.open(
|
|
204
|
+
new BufferedInputStream(assets.open(RNSentryModuleImpl.modulesPath))) {
|
|
206
205
|
int size = stream.available();
|
|
207
206
|
byte[] buffer = new byte[size];
|
|
208
207
|
stream.read(buffer);
|
|
209
208
|
stream.close();
|
|
210
|
-
String modulesJson = new String(buffer,
|
|
209
|
+
String modulesJson = new String(buffer, RNSentryModuleImpl.UTF_8);
|
|
211
210
|
promise.resolve(modulesJson);
|
|
212
211
|
} catch (FileNotFoundException e) {
|
|
213
212
|
promise.resolve(null);
|
|
@@ -217,7 +216,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
217
216
|
}
|
|
218
217
|
}
|
|
219
218
|
|
|
220
|
-
@ReactMethod
|
|
221
219
|
public void fetchNativeRelease(Promise promise) {
|
|
222
220
|
WritableMap release = Arguments.createMap();
|
|
223
221
|
release.putString("id", packageInfo.packageName);
|
|
@@ -226,7 +224,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
226
224
|
promise.resolve(release);
|
|
227
225
|
}
|
|
228
226
|
|
|
229
|
-
@ReactMethod
|
|
230
227
|
public void fetchNativeAppStart(Promise promise) {
|
|
231
228
|
final AppStartState appStartInstance = AppStartState.getInstance();
|
|
232
229
|
final Date appStartTime = appStartInstance.getAppStartTime();
|
|
@@ -258,7 +255,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
258
255
|
/**
|
|
259
256
|
* Returns frames metrics at the current point in time.
|
|
260
257
|
*/
|
|
261
|
-
@ReactMethod
|
|
262
258
|
public void fetchNativeFrames(Promise promise) {
|
|
263
259
|
if (!isFrameMetricsAggregatorAvailable()) {
|
|
264
260
|
promise.resolve(null);
|
|
@@ -308,7 +304,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
308
304
|
}
|
|
309
305
|
}
|
|
310
306
|
|
|
311
|
-
@ReactMethod
|
|
312
307
|
public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
|
|
313
308
|
byte[] bytes = new byte[rawBytes.size()];
|
|
314
309
|
for (int i = 0; i < rawBytes.size(); i++) {
|
|
@@ -333,7 +328,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
333
328
|
promise.resolve(true);
|
|
334
329
|
}
|
|
335
330
|
|
|
336
|
-
@ReactMethod
|
|
337
331
|
public void captureScreenshot(Promise promise) {
|
|
338
332
|
|
|
339
333
|
final Activity activity = getCurrentActivity();
|
|
@@ -373,7 +367,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
373
367
|
}
|
|
374
368
|
}
|
|
375
369
|
|
|
376
|
-
@ReactMethod
|
|
377
370
|
public void setUser(final ReadableMap userKeys, final ReadableMap userDataKeys) {
|
|
378
371
|
Sentry.configureScope(scope -> {
|
|
379
372
|
if (userKeys == null && userDataKeys == null) {
|
|
@@ -424,7 +417,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
424
417
|
});
|
|
425
418
|
}
|
|
426
419
|
|
|
427
|
-
@ReactMethod
|
|
428
420
|
public void addBreadcrumb(final ReadableMap breadcrumb) {
|
|
429
421
|
Sentry.configureScope(scope -> {
|
|
430
422
|
Breadcrumb breadcrumbInstance = new Breadcrumb();
|
|
@@ -464,7 +456,7 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
464
456
|
|
|
465
457
|
if (breadcrumb.hasKey("data")) {
|
|
466
458
|
final ReadableMap data = breadcrumb.getMap("data");
|
|
467
|
-
for(final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
459
|
+
for (final Map.Entry<String, Object> entry : data.toHashMap().entrySet()) {
|
|
468
460
|
final Object value = entry.getValue();
|
|
469
461
|
// data is ConcurrentHashMap and can't have null values
|
|
470
462
|
if (value != null) {
|
|
@@ -477,21 +469,18 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
477
469
|
});
|
|
478
470
|
}
|
|
479
471
|
|
|
480
|
-
@ReactMethod
|
|
481
472
|
public void clearBreadcrumbs() {
|
|
482
473
|
Sentry.configureScope(scope -> {
|
|
483
474
|
scope.clearBreadcrumbs();
|
|
484
475
|
});
|
|
485
476
|
}
|
|
486
477
|
|
|
487
|
-
@ReactMethod
|
|
488
478
|
public void setExtra(String key, String extra) {
|
|
489
479
|
Sentry.configureScope(scope -> {
|
|
490
480
|
scope.setExtra(key, extra);
|
|
491
481
|
});
|
|
492
482
|
}
|
|
493
483
|
|
|
494
|
-
@ReactMethod
|
|
495
484
|
public void setContext(final String key, final ReadableMap context) {
|
|
496
485
|
if (key == null || context == null) {
|
|
497
486
|
return;
|
|
@@ -503,14 +492,12 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
503
492
|
});
|
|
504
493
|
}
|
|
505
494
|
|
|
506
|
-
@ReactMethod
|
|
507
495
|
public void setTag(String key, String value) {
|
|
508
496
|
Sentry.configureScope(scope -> {
|
|
509
497
|
scope.setTag(key, value);
|
|
510
498
|
});
|
|
511
499
|
}
|
|
512
500
|
|
|
513
|
-
@ReactMethod
|
|
514
501
|
public void closeNativeSdk(Promise promise) {
|
|
515
502
|
Sentry.close();
|
|
516
503
|
|
|
@@ -519,7 +506,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
519
506
|
promise.resolve(true);
|
|
520
507
|
}
|
|
521
508
|
|
|
522
|
-
@ReactMethod
|
|
523
509
|
public void enableNativeFramesTracking() {
|
|
524
510
|
androidXAvailable = checkAndroidXAvailability();
|
|
525
511
|
|
|
@@ -545,7 +531,6 @@ public class RNSentryModule extends ReactContextBaseJavaModule {
|
|
|
545
531
|
}
|
|
546
532
|
}
|
|
547
533
|
|
|
548
|
-
@ReactMethod
|
|
549
534
|
public void disableNativeFramesTracking() {
|
|
550
535
|
if (isFrameMetricsAggregatorAvailable()) {
|
|
551
536
|
frameMetricsAggregator.stop();
|
|
@@ -1,30 +1,46 @@
|
|
|
1
1
|
package io.sentry.react;
|
|
2
2
|
|
|
3
|
-
import
|
|
4
|
-
|
|
5
|
-
import java.util.
|
|
3
|
+
import androidx.annotation.Nullable;
|
|
4
|
+
|
|
5
|
+
import java.util.HashMap;
|
|
6
|
+
import java.util.Map;
|
|
6
7
|
|
|
7
|
-
import com.facebook.react.ReactPackage;
|
|
8
8
|
import com.facebook.react.bridge.NativeModule;
|
|
9
9
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
10
|
-
import com.facebook.react.
|
|
11
|
-
import com.facebook.react.
|
|
10
|
+
import com.facebook.react.module.model.ReactModuleInfo;
|
|
11
|
+
import com.facebook.react.module.model.ReactModuleInfoProvider;
|
|
12
|
+
import com.facebook.react.TurboReactPackage;
|
|
12
13
|
|
|
13
|
-
public class RNSentryPackage
|
|
14
|
-
public RNSentryPackage() {
|
|
15
|
-
}
|
|
14
|
+
public class RNSentryPackage extends TurboReactPackage {
|
|
16
15
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
16
|
+
@Nullable
|
|
17
|
+
@Override
|
|
18
|
+
public NativeModule getModule(String name, ReactApplicationContext reactContext) {
|
|
19
|
+
if (name.equals(RNSentryModuleImpl.NAME)) {
|
|
20
|
+
return new RNSentryModule(reactContext);
|
|
21
|
+
} else {
|
|
22
|
+
return null;
|
|
20
23
|
}
|
|
24
|
+
}
|
|
21
25
|
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
26
|
+
@Override
|
|
27
|
+
public ReactModuleInfoProvider getReactModuleInfoProvider() {
|
|
28
|
+
return () -> {
|
|
29
|
+
final Map<String, ReactModuleInfo> moduleInfos = new HashMap<>();
|
|
30
|
+
boolean isTurboModule = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED;
|
|
31
|
+
moduleInfos.put(
|
|
32
|
+
RNSentryModuleImpl.NAME,
|
|
33
|
+
new ReactModuleInfo(
|
|
34
|
+
RNSentryModuleImpl.NAME,
|
|
35
|
+
RNSentryModuleImpl.NAME,
|
|
36
|
+
false, // canOverrideExistingModule
|
|
37
|
+
false, // needsEagerInit
|
|
38
|
+
true, // hasConstants
|
|
39
|
+
false, // isCxxModule
|
|
40
|
+
isTurboModule // isTurboModule
|
|
41
|
+
));
|
|
42
|
+
return moduleInfos;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
25
45
|
|
|
26
|
-
@Override
|
|
27
|
-
public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
|
|
28
|
-
return Collections.emptyList();
|
|
29
|
-
}
|
|
30
46
|
}
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
package io.sentry.react;
|
|
2
|
+
|
|
3
|
+
import androidx.annotation.NonNull;
|
|
4
|
+
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext;
|
|
6
|
+
import com.facebook.react.bridge.ReadableArray;
|
|
7
|
+
import com.facebook.react.bridge.ReadableMap;
|
|
8
|
+
import com.facebook.react.bridge.Promise;
|
|
9
|
+
|
|
10
|
+
public class RNSentryModule extends NativeRNSentrySpec {
|
|
11
|
+
|
|
12
|
+
private final RNSentryModuleImpl impl;
|
|
13
|
+
|
|
14
|
+
RNSentryModule(ReactApplicationContext reactContext) {
|
|
15
|
+
super(reactContext);
|
|
16
|
+
this.impl = new RNSentryModuleImpl(reactContext);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
@Override
|
|
20
|
+
@NonNull
|
|
21
|
+
public String getName() {
|
|
22
|
+
return RNSentryModuleImpl.NAME;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
@Override
|
|
26
|
+
public void initNativeSdk(final ReadableMap rnOptions, Promise promise) {
|
|
27
|
+
this.impl.initNativeSdk(rnOptions, promise);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
@Override
|
|
31
|
+
public void crash() {
|
|
32
|
+
this.impl.crash();
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
@Override
|
|
36
|
+
public void fetchModules(Promise promise) {
|
|
37
|
+
this.impl.fetchModules(promise);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
@Override
|
|
41
|
+
public void fetchNativeRelease(Promise promise) {
|
|
42
|
+
this.impl.fetchNativeRelease(promise);
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
@Override
|
|
46
|
+
public void fetchNativeAppStart(Promise promise) {
|
|
47
|
+
this.impl.fetchNativeAppStart(promise);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
@Override
|
|
51
|
+
public void fetchNativeFrames(Promise promise) {
|
|
52
|
+
this.impl.fetchNativeFrames(promise);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
@Override
|
|
56
|
+
public void captureEnvelope(ReadableArray rawBytes, ReadableMap options, Promise promise) {
|
|
57
|
+
this.impl.captureEnvelope(rawBytes, options, promise);
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
@Override
|
|
61
|
+
public void captureScreenshot(Promise promise) {
|
|
62
|
+
this.impl.captureScreenshot(promise);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
@Override
|
|
66
|
+
public void setUser(final ReadableMap user, final ReadableMap otherUserKeys) {
|
|
67
|
+
this.impl.setUser(user, otherUserKeys);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
@Override
|
|
71
|
+
public void addBreadcrumb(final ReadableMap breadcrumb) {
|
|
72
|
+
this.impl.addBreadcrumb(breadcrumb);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
@Override
|
|
76
|
+
public void clearBreadcrumbs() {
|
|
77
|
+
this.impl.clearBreadcrumbs();
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@Override
|
|
81
|
+
public void setExtra(String key, String extra) {
|
|
82
|
+
this.impl.setExtra(key, extra);
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
@Override
|
|
86
|
+
public void setContext(final String key, final ReadableMap context) {
|
|
87
|
+
this.impl.setContext(key, context);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@Override
|
|
91
|
+
public void setTag(String key, String value) {
|
|
92
|
+
this.impl.setTag(key, value);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
@Override
|
|
96
|
+
public void closeNativeSdk(Promise promise) {
|
|
97
|
+
this.impl.closeNativeSdk(promise);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
@Override
|
|
101
|
+
public void enableNativeFramesTracking() {
|
|
102
|
+
this.impl.enableNativeFramesTracking();
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
@Override
|
|
106
|
+
public void disableNativeFramesTracking() {
|
|
107
|
+
this.impl.disableNativeFramesTracking();
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
@Override
|
|
111
|
+
public void fetchNativeDeviceContexts(Promise promise) {
|
|
112
|
+
// Not used on android
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
@Override
|
|
116
|
+
public void fetchNativeSdkInfo(Promise promise) {
|
|
117
|
+
// Not used on android
|
|
118
|
+
}
|
|
119
|
+
}
|