Skip to content

Commit 52f5e03

Browse files
Merge 6d8c4dd into 5d6473b
2 parents 5d6473b + 6d8c4dd commit 52f5e03

File tree

63 files changed

+2444
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+2444
-114
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,3 +74,6 @@ yalc.lock
7474

7575
# E2E tests
7676
test/react-native/versions
77+
78+
# Created by Sentry Metro Plugin
79+
.sentry/

CHANGELOG.md

Lines changed: 91 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -4,24 +4,56 @@
44

55
### Features
66

7-
- Improve touch event component info if annotated with [`@sentry/babel-plugin-component-annotate`](https://www.npmjs.com/package/@sentry/babel-plugin-component-annotate) ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899))
87
- Set `currentScreen` on native scope ([#3927](https://github.com/getsentry/sentry-react-native/pull/3927))
8+
- Add `annotateReactComponents` option to `@sentry/react-native/metro` ([#3916](https://github.com/getsentry/sentry-react-native/pull/3916))
9+
10+
```js
11+
// For Expo
12+
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
13+
const config = getSentryExpoConfig(__dirname, { annotateReactComponents: true });
14+
15+
// For RN
16+
const { getDefaultConfig } = require('@react-native/metro-config');
17+
const { withSentryConfig } = require('@sentry/react-native/metro');
18+
module.exports = withSentryConfig(getDefaultConfig(__dirname), { annotateReactComponents: true });
19+
```
920

1021
### Fixes
1122

23+
- Add `app.foreground/background` breadcrumbs to iOS Replays ([#3932](https://github.com/getsentry/sentry-react-native/pull/3932))
1224
- errors with cause are now correctly serialized on debug build ([#3920](https://github.com/getsentry/sentry-react-native/pull/3920))
13-
- `sentry-expo-upload-sourcemaps` no longer requires Sentry url when uploading sourcemaps to `sentry.io` ([#3915](https://github.com/getsentry/sentry-react-native/pull/3915))
1425
- Flavor aware Android builds use `SENTRY_AUTH_TOKEN` env as fallback when token not found in `sentry-flavor-type.properties`. ([#3917](https://github.com/getsentry/sentry-react-native/pull/3917))
1526
- `mechanism.handled:false` should crash current session ([#3900](https://github.com/getsentry/sentry-react-native/pull/3900))
1627

1728
### Dependencies
1829

19-
- Bump Cocoa SDK from v8.29.1 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
30+
- Bump Android SDK from v7.11.0-alpha.2 to v7.12.0-alpha.3 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
31+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.12.0-alpha.3/CHANGELOG.md#7120-alpha3)
32+
- [diff](https://github.com/getsentry/sentry-java/compare/7.11.0-alpha.2...7.12.0-alpha.3)
33+
34+
## 5.25.0-alpha.2
35+
36+
### Features
37+
38+
- Improve touch event component info if annotated with [`@sentry/babel-plugin-component-annotate`](https://www.npmjs.com/package/@sentry/babel-plugin-component-annotate) ([#3899](https://github.com/getsentry/sentry-react-native/pull/3899))
39+
- Add replay breadcrumbs for touch & navigation events ([#3846](https://github.com/getsentry/sentry-react-native/pull/3846))
40+
- Add network data to Session Replays ([#3912](https://github.com/getsentry/sentry-react-native/pull/3912))
41+
- Filter Sentry Event Breadcrumbs from Mobile Replays ([#3925](https://github.com/getsentry/sentry-react-native/pull/3925))
42+
43+
### Fixes
44+
45+
- `sentry-expo-upload-sourcemaps` no longer requires Sentry url when uploading sourcemaps to `sentry.io` ([#3915](https://github.com/getsentry/sentry-react-native/pull/3915))
46+
47+
### Dependencies
48+
49+
- Bump Cocoa SDK from v8.25.0-alpha.0 to v8.30.0 ([#3914](https://github.com/getsentry/sentry-react-native/pull/3914))
2050
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8300)
21-
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.29.1...8.30.0)
22-
- Bump Android SDK from v7.10.0 to v7.11.0 ([#3926](https://github.com/getsentry/sentry-react-native/pull/3926))
23-
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7110)
24-
- [diff](https://github.com/getsentry/sentry-java/compare/7.10.0...7.11.0)
51+
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.25.0-alpha.0...8.30.0)
52+
- Bump Android SDK from v7.9.0-alpha.1 to v7.11.0-alpha.2 ([#3830](https://github.com/getsentry/sentry-react-native/pull/3830))
53+
- [changelog](https://github.com/getsentry/sentry-java/blob/7.11.0-alpha.2/CHANGELOG.md#7110-alpha2)
54+
- [diff](https://github.com/getsentry/sentry-java/compare/7.9.0-alpha.1...7.11.0-alpha.2)
55+
56+
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
2557

2658
## 5.24.1
2759

@@ -122,6 +154,14 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
122154
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8270)
123155
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.26.0...8.27.0)
124156

157+
## 5.23.0-alpha.1
158+
159+
### Fixes
160+
161+
- Pass `replaysSessionSampleRate` option to Android ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
162+
163+
Access to Mobile Replay is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
164+
125165
## 5.22.3
126166

127167
### Fixes
@@ -155,6 +195,47 @@ This release does *not* build on iOS. Please use `5.23.1` or newer.
155195
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8250)
156196
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.24.0...8.25.0)
157197

198+
## 5.23.0-alpha.0
199+
200+
### Features
201+
202+
- Mobile Session Replay Alpha ([#3714](https://github.com/getsentry/sentry-react-native/pull/3714))
203+
204+
To enable Replay for React Native on mobile and web add the following options.
205+
206+
```js
207+
Sentry.init({
208+
_experiments: {
209+
replaysSessionSampleRate: 1.0,
210+
replaysOnErrorSampleRate: 1.0,
211+
},
212+
});
213+
```
214+
215+
To change the default Mobile Replay options add the `mobileReplayIntegration`.
216+
217+
```js
218+
Sentry.init({
219+
_experiments: {
220+
replaysSessionSampleRate: 1.0,
221+
replaysOnErrorSampleRate: 1.0,
222+
},
223+
integration: [
224+
Sentry.mobileReplayIntegration({
225+
maskAllText: true,
226+
maskAllImages: true,
227+
}),
228+
],
229+
});
230+
```
231+
232+
Access is limited to early access orgs on Sentry. If you're interested, [sign up for the waitlist](https://sentry.io/lp/mobile-replay-beta/)
233+
234+
### Dependencies
235+
236+
- Bump Cocoa SDK to [8.25.0-alpha.0](https://github.com/getsentry/sentry-cocoa/releases/tag/8.25.0-alpha.0)
237+
- Bump Android SDK to [7.9.0-alpha.1](https://github.com/getsentry/sentry-java/releases/tag/7.9.0-alpha.1)
238+
158239
## 5.22.0
159240

160241
### Features
@@ -433,7 +514,7 @@ see [the Expo guide](https://docs.sentry.io/platforms/react-native/manual-setup/
433514
const { getSentryExpoConfig } = require("@sentry/react-native/metro");
434515

435516
// const config = getDefaultConfig(__dirname);
436-
const config = getSentryExpoConfig(config, {});
517+
const config = getSentryExpoConfig(__dirname);
437518
```
438519

439520
- New `npx sentry-expo-upload-sourcemaps` for simple EAS Update (`npx expo export`) source maps upload ([#3491](https://github.com/getsentry/sentry-react-native/pull/3491), [#3510](https://github.com/getsentry/sentry-react-native/pull/3510), [#3515](https://github.com/getsentry/sentry-react-native/pull/3515), [#3507](https://github.com/getsentry/sentry-react-native/pull/3507))
@@ -665,7 +746,7 @@ This release is compatible with `[email protected]` and newer.
665746
});
666747
```
667748

668-
Read more at https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690
749+
Read more at <https://github.com/getsentry/sentry-javascript/blob/develop/CHANGELOG.md#7690>
669750

670751
- Report current screen in `contexts.app.view_names` ([#3339](https://github.com/getsentry/sentry-react-native/pull/3339))
671752

@@ -2704,7 +2785,7 @@ We are looking into ways making this more stable and plan to re-enable it again
27042785

27052786
## v0.23.2
27062787

2707-
- Fixed #228 again ¯\\_(ツ)_
2788+
- Fixed #228 again ¯\\*(ツ)*
27082789

27092790
## v0.23.1
27102791

Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
package io.sentry.rnsentryandroidtester
2+
3+
import io.sentry.Breadcrumb
4+
import io.sentry.react.RNSentryReplayBreadcrumbConverter
5+
import io.sentry.rrweb.RRWebBreadcrumbEvent
6+
import org.junit.Assert.assertEquals
7+
import org.junit.Test
8+
import org.junit.runner.RunWith
9+
import org.junit.runners.JUnit4
10+
11+
@RunWith(JUnit4::class)
12+
class RNSentryReplayBreadcrumbConverterTest {
13+
14+
@Test
15+
fun testConvertForegroundBreadcrumb() {
16+
val converter = RNSentryReplayBreadcrumbConverter()
17+
val testBreadcrumb = Breadcrumb()
18+
testBreadcrumb.type = "navigation"
19+
testBreadcrumb.category = "app.lifecycle"
20+
testBreadcrumb.setData("state", "foreground");
21+
val actual = converter.convert(testBreadcrumb) as RRWebBreadcrumbEvent
22+
23+
assertEquals("app.foreground", actual.category)
24+
}
25+
26+
@Test
27+
fun testConvertBackgroundBreadcrumb() {
28+
val converter = RNSentryReplayBreadcrumbConverter()
29+
val testBreadcrumb = Breadcrumb()
30+
testBreadcrumb.type = "navigation"
31+
testBreadcrumb.category = "app.lifecycle"
32+
testBreadcrumb.setData("state", "background");
33+
val actual = converter.convert(testBreadcrumb) as RRWebBreadcrumbEvent
34+
35+
assertEquals("app.background", actual.category)
36+
}
37+
38+
@Test
39+
fun doesNotConvertSentryEventBreadcrumb() {
40+
val converter = RNSentryReplayBreadcrumbConverter()
41+
val testBreadcrumb = Breadcrumb();
42+
testBreadcrumb.category = "sentry.event"
43+
val actual = converter.convert(testBreadcrumb)
44+
assertEquals(null, actual)
45+
}
46+
47+
@Test
48+
fun doesNotConvertSentryTransactionBreadcrumb() {
49+
val converter = RNSentryReplayBreadcrumbConverter()
50+
val testBreadcrumb = Breadcrumb();
51+
testBreadcrumb.category = "sentry.transaction"
52+
val actual = converter.convert(testBreadcrumb)
53+
assertEquals(null, actual)
54+
}
55+
56+
@Test
57+
fun doesNotConvertNullPath() {
58+
val actual = RNSentryReplayBreadcrumbConverter.getTouchPathMessage(null)
59+
assertEquals(null, actual)
60+
}
61+
62+
@Test
63+
fun doesNotConvertPathContainingNull() {
64+
val actual = RNSentryReplayBreadcrumbConverter.getTouchPathMessage(arrayListOf(arrayOfNulls<Any>(1)))
65+
assertEquals(null, actual)
66+
}
67+
68+
@Test
69+
fun doesNotConvertPathWithValuesMissingNameAndLevel() {
70+
val actual = RNSentryReplayBreadcrumbConverter.getTouchPathMessage(arrayListOf(mapOf(
71+
"element" to "element4",
72+
"file" to "file4")))
73+
assertEquals(null, actual)
74+
}
75+
76+
@Test
77+
fun doesConvertValidPathExample1() {
78+
val actual = RNSentryReplayBreadcrumbConverter.getTouchPathMessage(listOf(
79+
mapOf("label" to "label0"),
80+
mapOf("name" to "name1"),
81+
mapOf("name" to "item2", "label" to "label2"),
82+
mapOf("name" to "item3", "label" to "label3", "element" to "element3"),
83+
mapOf("name" to "item4", "label" to "label4", "file" to "file4"),
84+
mapOf("name" to "item5", "label" to "label5", "element" to "element5", "file" to "file5")))
85+
assertEquals("label3(element3) > label2 > name1 > label0", actual)
86+
}
87+
88+
@Test
89+
fun doesConvertValidPathExample2() {
90+
val actual = RNSentryReplayBreadcrumbConverter.getTouchPathMessage(listOf(
91+
mapOf("name" to "item2", "label" to "label2"),
92+
mapOf("name" to "item3", "label" to "label3", "element" to "element3"),
93+
mapOf("name" to "item4", "label" to "label4", "file" to "file4"),
94+
mapOf("name" to "item5", "label" to "label5", "element" to "element5", "file" to "file5"),
95+
mapOf("label" to "label6"),
96+
mapOf("name" to "name7")))
97+
assertEquals("label5(element5, file5) > label4(file4) > label3(element3) > label2", actual)
98+
}
99+
}

RNSentryCocoaTester/RNSentryCocoaTester.xcodeproj/project.pbxproj

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@
77
objects = {
88

99
/* Begin PBXBuildFile section */
10-
3360843D2C340C76008CC412 /* RNSentryBreadcrumbTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */; };
10+
330F308C2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 330F308B2C0F3840002A0D4E /* RNSentryBreadcrumbTests.m */; };
11+
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */; };
1112
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33958C682BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m */; };
1213
33AFDFED2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */; };
1314
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 33AFDFF02B8D15E500AAB120 /* RNSentryDependencyContainerTests.m */; };
@@ -18,7 +19,9 @@
1819
/* Begin PBXFileReference section */
1920
1482D5685A340AB93348A43D /* Pods-RNSentryCocoaTesterTests.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-RNSentryCocoaTesterTests.release.xcconfig"; path = "Target Support Files/Pods-RNSentryCocoaTesterTests/Pods-RNSentryCocoaTesterTests.release.xcconfig"; sourceTree = "<group>"; };
2021
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryBreadcrumb.h; path = ../ios/RNSentryBreadcrumb.h; sourceTree = "<group>"; };
21-
3360843B2C340C75008CC412 /* RNSentryCocoaTesterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryCocoaTesterTests-Bridging-Header.h"; sourceTree = "<group>"; };
22+
336084372C32E382008CC412 /* RNSentryCocoaTesterTests-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNSentryCocoaTesterTests-Bridging-Header.h"; sourceTree = "<group>"; };
23+
336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = RNSentryReplayBreadcrumbConverterTests.swift; sourceTree = "<group>"; };
24+
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RNSentryReplayBreadcrumbConverter.h; path = ../ios/RNSentryReplayBreadcrumbConverter.h; sourceTree = "<group>"; };
2225
3360843C2C340C76008CC412 /* RNSentryBreadcrumbTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNSentryBreadcrumbTests.swift; sourceTree = "<group>"; };
2326
3360898D29524164007C7730 /* RNSentryCocoaTesterTests.xctest */ = {isa = PBXFileReference; explicitFileType = wrapper.cfbundle; includeInIndex = 0; path = RNSentryCocoaTesterTests.xctest; sourceTree = BUILT_PRODUCTS_DIR; };
2427
338739072A7D7D2800950DDD /* RNSentryTests.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNSentryTests.h; sourceTree = "<group>"; };
@@ -77,6 +80,7 @@
7780
3360899029524164007C7730 /* RNSentryCocoaTesterTests */ = {
7881
isa = PBXGroup;
7982
children = (
83+
336084382C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift */,
8084
33F58ACF2977037D008F60EA /* RNSentryTests.mm */,
8185
338739072A7D7D2800950DDD /* RNSentryTests.h */,
8286
33AFDFEC2B8D14B300AAB120 /* RNSentryFramesTrackerListenerTests.m */,
@@ -93,6 +97,7 @@
9397
33AFE0122B8F319000AAB120 /* RNSentry */ = {
9498
isa = PBXGroup;
9599
children = (
100+
3360843A2C32E3A8008CC412 /* RNSentryReplayBreadcrumbConverter.h */,
96101
330F308D2C0F385A002A0D4E /* RNSentryBreadcrumb.h */,
97102
33958C672BFCEF5A00AD1FB6 /* RNSentryOnDrawReporter.h */,
98103
33AFE0132B8F31AF00AAB120 /* RNSentryDependencyContainer.h */,
@@ -136,6 +141,7 @@
136141
isa = PBXProject;
137142
attributes = {
138143
BuildIndependentTargetsInParallel = 1;
144+
LastSwiftUpdateCheck = 1540;
139145
LastUpgradeCheck = 1420;
140146
TargetAttributes = {
141147
3360898C29524164007C7730 = {
@@ -210,6 +216,7 @@
210216
buildActionMask = 2147483647;
211217
files = (
212218
33AFDFF12B8D15E500AAB120 /* RNSentryDependencyContainerTests.m in Sources */,
219+
336084392C32E382008CC412 /* RNSentryReplayBreadcrumbConverterTests.swift in Sources */,
213220
33F58AD02977037D008F60EA /* RNSentryTests.mm in Sources */,
214221
33958C692BFCF12600AD1FB6 /* RNSentryOnDrawReporterTests.m in Sources */,
215222
3360843D2C340C76008CC412 /* RNSentryBreadcrumbTests.swift in Sources */,
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,6 @@
1+
//
2+
// Use this file to import your target's public headers that you would like to expose to Swift.
3+
//
4+
5+
#import "RNSentryReplayBreadcrumbConverter.h"
16
#import "RNSentryBreadcrumb.h"

0 commit comments

Comments
 (0)