Skip to content

Commit 6a3d7a9

Browse files
authored
Merge branch 'main' into antonis/skip-native-frames
2 parents 076c7ec + 12492c4 commit 6a3d7a9

36 files changed

Lines changed: 550 additions & 45 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,18 @@
66
> make sure you follow our [migration guide](https://docs.sentry.io/platforms/react-native/migration/) first.
77
<!-- prettier-ignore-end -->
88
9-
## Unreleased
9+
## 8.5.0
1010

1111
### Features
1212

1313
- Support `SENTRY_ENVIRONMENT` in bare React Native builds ([#5823](https://github.com/getsentry/sentry-react-native/pull/5823))
1414
- Add `expoUpdatesListenerIntegration` that records breadcrumbs for Expo Updates lifecycle events ([#5795](https://github.com/getsentry/sentry-react-native/pull/5795))
1515
- Tracks update checks, downloads, errors, rollbacks, and restarts as `expo.updates` breadcrumbs
1616
- Enabled by default in Expo apps (requires `expo-updates` to be installed)
17-
-
17+
- feat(android): Expose `enableAnrFingerprinting` option ([#5838](https://github.com/getsentry/sentry-react-native/issues/5838))
18+
- Show feedback widget on device shake ([#5754](https://github.com/getsentry/sentry-react-native/pull/5754))
19+
- Use `Sentry.enableFeedbackOnShake()` / `Sentry.disableFeedbackOnShake()` or set `feedbackIntegration({ enableShakeToReport: true })`
20+
1821
### Fixes
1922

2023
- Fix native frames measurements being dropped due to race condition ([#5813](https://github.com/getsentry/sentry-react-native/pull/5813))

SDK-VERSIONS.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ To manually update the table with the current version, run `./scripts/update-sdk
1212

1313
| React Native SDK | Android SDK | Cocoa SDK | JavaScript SDK |
1414
| ---------------- | ----------- | --------- | -------------- |
15+
| [8.5.0](https://github.com/getsentry/sentry-react-native/releases/tag/8.5.0) | [8.36.0](https://github.com/getsentry/sentry-java/releases/tag/8.36.0) | [9.7.0](https://github.com/getsentry/sentry-cocoa/releases/tag/9.7.0) | [10.44.0](https://github.com/getsentry/sentry-javascript/releases/tag/10.44.0) |
1516
| [8.4.0](https://github.com/getsentry/sentry-react-native/releases/tag/8.4.0) | [8.33.0](https://github.com/getsentry/sentry-java/releases/tag/8.33.0) | [9.7.0](https://github.com/getsentry/sentry-cocoa/releases/tag/9.7.0) | [10.43.0](https://github.com/getsentry/sentry-javascript/releases/tag/10.43.0) |
1617
| [8.3.0](https://github.com/getsentry/sentry-react-native/releases/tag/8.3.0) | [8.33.0](https://github.com/getsentry/sentry-java/releases/tag/8.33.0) | [9.6.0](https://github.com/getsentry/sentry-cocoa/releases/tag/9.6.0) | [10.42.0](https://github.com/getsentry/sentry-javascript/releases/tag/10.42.0) |
1718
| [8.2.0](https://github.com/getsentry/sentry-react-native/releases/tag/8.2.0) | [8.33.0](https://github.com/getsentry/sentry-java/releases/tag/8.33.0) | [9.5.1](https://github.com/getsentry/sentry-cocoa/releases/tag/9.5.1) | [10.39.0](https://github.com/getsentry/sentry-javascript/releases/tag/10.39.0) |

dev-packages/e2e-tests/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-e2e-tests",
3-
"version": "8.4.0",
3+
"version": "8.5.0",
44
"private": true,
55
"description": "Sentry React Native End to End Tests Library",
66
"main": "dist/index.js",
@@ -14,7 +14,7 @@
1414
"@babel/preset-env": "^7.25.3",
1515
"@babel/preset-typescript": "^7.18.6",
1616
"@sentry/core": "10.44.0",
17-
"@sentry/react-native": "8.4.0",
17+
"@sentry/react-native": "8.5.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",
2020
"appium": "2.4.1",

dev-packages/type-check/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "sentry-react-native-type-check",
33
"private": true,
4-
"version": "8.4.0",
4+
"version": "8.5.0",
55
"scripts": {
66
"type-check": "./run-type-check.sh"
77
}

dev-packages/utils/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sentry-react-native-samples-utils",
3-
"version": "8.4.0",
3+
"version": "8.5.0",
44
"description": "Internal Samples Utils",
55
"main": "index.js",
66
"license": "MIT",

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "node_modules/lerna/schemas/lerna-schema.json",
3-
"version": "8.4.0",
3+
"version": "8.5.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/android/src/main/java/io/sentry/react/RNSentryModuleImpl.java

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import io.sentry.android.core.InternalSentrySdk;
4646
import io.sentry.android.core.SentryAndroidDateProvider;
4747
import io.sentry.android.core.SentryAndroidOptions;
48+
import io.sentry.android.core.SentryShakeDetector;
4849
import io.sentry.android.core.ViewHierarchyEventProcessor;
4950
import io.sentry.android.core.internal.debugmeta.AssetsDebugMetaLoader;
5051
import io.sentry.android.core.internal.util.SentryFrameMetricsCollector;
@@ -122,6 +123,9 @@ public class RNSentryModuleImpl {
122123

123124
private final @NotNull Runnable emitNewFrameEvent;
124125

126+
private static final String ON_SHAKE_EVENT = "rn_sentry_on_shake";
127+
private @Nullable SentryShakeDetector shakeDetector;
128+
125129
/** Max trace file size in bytes. */
126130
private long maxTraceFileSize = 5 * 1024 * 1024;
127131

@@ -208,10 +212,58 @@ public void addListener(String eventType) {
208212
}
209213

210214
public void removeListeners(double id) {
211-
// Is must be defined otherwise the generated interface from TS won't be
212-
// fulfilled
213-
logger.log(
214-
SentryLevel.ERROR, "removeListeners of NativeEventEmitter can't be used on Android!");
215+
// removeListeners does not carry event-type information, so it cannot be used
216+
// to track shake listeners selectively. Shake detection is managed exclusively
217+
// via enableShakeDetection / disableShakeDetection.
218+
}
219+
220+
private void startShakeDetection() {
221+
if (shakeDetector != null) {
222+
return;
223+
}
224+
225+
try { // NOPMD - We don't want to crash in any case
226+
final ReactApplicationContext context = getReactApplicationContext();
227+
shakeDetector = new SentryShakeDetector(logger);
228+
shakeDetector.start(
229+
context,
230+
() -> {
231+
try { // NOPMD - We don't want to crash in any case
232+
final ReactApplicationContext ctx = getReactApplicationContext();
233+
if (ctx.hasActiveReactInstance()) {
234+
ctx.getJSModule(
235+
com.facebook.react.modules.core.DeviceEventManagerModule
236+
.RCTDeviceEventEmitter.class)
237+
.emit(ON_SHAKE_EVENT, null);
238+
}
239+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
240+
logger.log(SentryLevel.WARNING, "Failed to emit shake event.", e);
241+
}
242+
});
243+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
244+
logger.log(SentryLevel.WARNING, "Failed to start shake detection.", e);
245+
shakeDetector = null;
246+
}
247+
}
248+
249+
private void stopShakeDetection() {
250+
try { // NOPMD - We don't want to crash in any case
251+
if (shakeDetector != null) {
252+
shakeDetector.stop();
253+
shakeDetector = null;
254+
}
255+
} catch (Throwable e) { // NOPMD - We don't want to crash in any case
256+
logger.log(SentryLevel.WARNING, "Failed to stop shake detection.", e);
257+
shakeDetector = null;
258+
}
259+
}
260+
261+
public void enableShakeDetection() {
262+
startShakeDetection();
263+
}
264+
265+
public void disableShakeDetection() {
266+
stopShakeDetection();
215267
}
216268

217269
public void fetchModules(Promise promise) {

packages/core/android/src/main/java/io/sentry/react/RNSentryStart.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ static void getSentryAndroidOptions(
151151
if (rnOptions.hasKey("enableTombstone")) {
152152
options.setTombstoneEnabled(rnOptions.getBoolean("enableTombstone"));
153153
}
154+
if (rnOptions.hasKey("enableAnrFingerprinting")) {
155+
options.setEnableAnrFingerprinting(rnOptions.getBoolean("enableAnrFingerprinting"));
156+
}
154157
if (rnOptions.hasKey("spotlight")) {
155158
if (rnOptions.getType("spotlight") == ReadableType.Boolean) {
156159
options.setEnableSpotlight(rnOptions.getBoolean("spotlight"));

packages/core/android/src/main/java/io/sentry/react/RNSentryVersion.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
class RNSentryVersion {
44
static final String REACT_NATIVE_SDK_PACKAGE_NAME = "npm:@sentry/react-native";
5-
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "8.4.0";
5+
static final String REACT_NATIVE_SDK_PACKAGE_VERSION = "8.5.0";
66
static final String NATIVE_SDK_NAME = "sentry.native.android.react-native";
77
static final String ANDROID_SDK_NAME = "sentry.java.android.react-native";
88
static final String REACT_NATIVE_SDK_NAME = "sentry.javascript.react-native";

packages/core/android/src/newarch/java/io/sentry/react/RNSentryModule.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,4 +212,14 @@ public void popTimeToDisplayFor(String key, Promise promise) {
212212
public boolean setActiveSpanId(String spanId) {
213213
return this.impl.setActiveSpanId(spanId);
214214
}
215+
216+
@Override
217+
public void enableShakeDetection() {
218+
this.impl.enableShakeDetection();
219+
}
220+
221+
@Override
222+
public void disableShakeDetection() {
223+
this.impl.disableShakeDetection();
224+
}
215225
}

0 commit comments

Comments
 (0)