Skip to content

Commit b6d933c

Browse files
Merge dbdd4b5 into a18210a
2 parents a18210a + dbdd4b5 commit b6d933c

File tree

65 files changed

+2659
-793
lines changed

Some content is hidden

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

65 files changed

+2659
-793
lines changed

CHANGELOG.md

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,59 @@
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+
## 6.7.0-alpha.0
10+
11+
### Features
12+
13+
- Capture App Start errors and crashes by initializing Sentry from `sentry.options.json` ([#4472](https://github.com/getsentry/sentry-react-native/pull/4472))
14+
15+
Create `sentry.options.json` in the React Native project root and set options the same as you currently have in `Sentry.init` in JS.
16+
17+
```json
18+
{
19+
"dsn": "https://key@example.io/value",
20+
}
21+
```
22+
23+
Initialize Sentry on the native layers by newly provided native methods.
24+
25+
```kotlin
26+
import io.sentry.react.RNSentrySDK
27+
28+
class MainApplication : Application(), ReactApplication {
29+
override fun onCreate() {
30+
super.onCreate()
31+
RNSentrySDK.init(this)
32+
}
33+
}
34+
```
35+
36+
```obj-c
37+
#import <RNSentry/RNSentry.h>
38+
39+
@implementation AppDelegate
40+
- (BOOL)application:(UIApplication *)application
41+
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
42+
{
43+
[RNSentrySDK start];
44+
return [super application:application didFinishLaunchingWithOptions:launchOptions];
45+
}
46+
@end
47+
```
48+
49+
### Changes
50+
51+
- Load `optionsFile` into the JS bundle during Metro bundle process ([#4476](https://github.com/getsentry/sentry-react-native/pull/4476))
52+
- Add experimental version of `startWithConfigureOptions` for Apple platforms ([#4444](https://github.com/getsentry/sentry-react-native/pull/4444))
53+
- Add experimental version of `init` with optional `OptionsConfiguration<SentryAndroidOptions>` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
54+
- Add initialization using `sentry.options.json` for Apple platforms ([#4447](https://github.com/getsentry/sentry-react-native/pull/4447))
55+
- Add initialization using `sentry.options.json` for Android ([#4451](https://github.com/getsentry/sentry-react-native/pull/4451))
56+
- Merge options from file with `Sentry.init` options in JS ([#4510](https://github.com/getsentry/sentry-react-native/pull/4510))
57+
58+
### Internal
59+
60+
- Extract iOS native initialization to standalone structures ([#4442](https://github.com/getsentry/sentry-react-native/pull/4442))
61+
- Extract Android native initialization to standalone structures ([#4445](https://github.com/getsentry/sentry-react-native/pull/4445))
1062
1163
### Dependencies
1264

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": "6.6.0",
3+
"version": "6.7.0-alpha.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": "8.54.0",
17-
"@sentry/react-native": "6.6.0",
17+
"@sentry/react-native": "6.7.0-alpha.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": "6.6.0",
4+
"version": "6.7.0-alpha.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": "6.6.0",
3+
"version": "6.7.0-alpha.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": "6.6.0",
3+
"version": "6.7.0-alpha.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/RNSentry.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Pod::Spec.new do |s|
3333
s.preserve_paths = '*.js'
3434

3535
s.source_files = 'ios/**/*.{h,m,mm}'
36-
s.public_header_files = 'ios/RNSentry.h'
36+
s.public_header_files = 'ios/RNSentry.h', 'ios/RNSentrySDK.h'
3737

3838
s.compiler_flags = other_cflags
3939

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
"dsn": "invalid-dsn"
3+
}
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
invalid-options
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
{
2+
"dsn": "https://abcd@efgh.ingest.sentry.io/123456",
3+
"enableTracing": true,
4+
"tracesSampleRate": 1.0
5+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
package io.sentry.react
2+
3+
import androidx.test.ext.junit.runners.AndroidJUnit4
4+
import com.facebook.react.bridge.WritableArray
5+
import com.facebook.react.bridge.WritableMap
6+
import io.sentry.react.RNSentryJsonConverter.convertToWritable
7+
import org.json.JSONArray
8+
import org.json.JSONObject
9+
import org.junit.Assert.assertEquals
10+
import org.junit.Assert.assertNotNull
11+
import org.junit.Assert.assertNull
12+
import org.junit.Test
13+
import org.junit.runner.RunWith
14+
15+
@RunWith(AndroidJUnit4::class)
16+
class RNSentryJsonConverterTest {
17+
@Test
18+
fun testConvertToWritableWithSimpleJsonObject() {
19+
val jsonObject =
20+
JSONObject().apply {
21+
put("floatKey", 12.3f)
22+
put("doubleKey", 12.3)
23+
put("intKey", 123)
24+
put("stringKey", "test")
25+
put("nullKey", JSONObject.NULL)
26+
}
27+
28+
val result: WritableMap? = convertToWritable(jsonObject)
29+
30+
assertNotNull(result)
31+
assertEquals(12.3, result!!.getDouble("floatKey"), 0.0001)
32+
assertEquals(12.3, result.getDouble("doubleKey"), 0.0)
33+
assertEquals(123, result.getInt("intKey"))
34+
assertEquals("test", result.getString("stringKey"))
35+
assertNull(result.getString("nullKey"))
36+
}
37+
38+
@Test
39+
fun testConvertToWritableWithNestedJsonObject() {
40+
val jsonObject =
41+
JSONObject().apply {
42+
put(
43+
"nested",
44+
JSONObject().apply {
45+
put("key", "value")
46+
},
47+
)
48+
}
49+
50+
val result: WritableMap? = convertToWritable(jsonObject)
51+
52+
assertNotNull(result)
53+
val nestedMap = result!!.getMap("nested")
54+
assertNotNull(nestedMap)
55+
assertEquals("value", nestedMap!!.getString("key"))
56+
}
57+
58+
@Test
59+
fun testConvertToWritableWithJsonArray() {
60+
val jsonArray =
61+
JSONArray().apply {
62+
put(1)
63+
put(2.5)
64+
put("string")
65+
put(JSONObject.NULL)
66+
}
67+
68+
val result: WritableArray = convertToWritable(jsonArray)
69+
70+
assertEquals(1, result.getInt(0))
71+
assertEquals(2.5, result.getDouble(1), 0.0)
72+
assertEquals("string", result.getString(2))
73+
assertNull(result.getString(3))
74+
}
75+
76+
@Test
77+
fun testConvertToWritableWithNestedJsonArray() {
78+
val jsonObject =
79+
JSONObject().apply {
80+
put(
81+
"array",
82+
JSONArray().apply {
83+
put(
84+
JSONObject().apply {
85+
put("key1", "value1")
86+
},
87+
)
88+
put(
89+
JSONObject().apply {
90+
put("key2", "value2")
91+
},
92+
)
93+
},
94+
)
95+
}
96+
97+
val result: WritableMap? = convertToWritable(jsonObject)
98+
99+
val array = result?.getArray("array")
100+
assertEquals("value1", array?.getMap(0)?.getString("key1"))
101+
assertEquals("value2", array?.getMap(1)?.getString("key2"))
102+
}
103+
}

0 commit comments

Comments
 (0)