Skip to content

Commit c05fc5f

Browse files
committed
Merge branch 'antonis/4358-Feedback-Form-Autoinject-Button' into antonis/feedback-theme
# Conflicts: # CHANGELOG.md
2 parents 183796c + 10a70a3 commit c05fc5f

File tree

82 files changed

+1694
-490
lines changed

Some content is hidden

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

82 files changed

+1694
-490
lines changed

.github/workflows/codeql-analysis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ jobs:
4444

4545
# Initializes the CodeQL tools for scanning.
4646
- name: Initialize CodeQL
47-
uses: github/codeql-action/init@6bb031afdd8eb862ea3fc1848194185e076637e5 # [email protected].11
47+
uses: github/codeql-action/init@5f8171a638ada777af81d42b55959a643bb29017 # [email protected].12
4848
with:
4949
languages: ${{ matrix.language }}
5050
# If you wish to specify custom queries, you can do so here or in a config file.
@@ -55,7 +55,7 @@ jobs:
5555
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
5656
# If this step fails, then you should remove it and run the build manually (see below)
5757
- name: Autobuild
58-
uses: github/codeql-action/autobuild@6bb031afdd8eb862ea3fc1848194185e076637e5 # [email protected].11
58+
uses: github/codeql-action/autobuild@5f8171a638ada777af81d42b55959a643bb29017 # [email protected].12
5959

6060
# ℹ️ Command-line programs to run using the OS shell.
6161
# 📚 https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
@@ -66,4 +66,4 @@ jobs:
6666
# make bootstrap
6767
# make release
6868
- name: Perform CodeQL Analysis
69-
uses: github/codeql-action/analyze@6bb031afdd8eb862ea3fc1848194185e076637e5 # [email protected].11
69+
uses: github/codeql-action/analyze@5f8171a638ada777af81d42b55959a643bb29017 # [email protected].12

.github/workflows/e2e.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ jobs:
159159
USE_FRAMEWORKS: ${{ matrix.ios-use-frameworks }}
160160
PRODUCTION: ${{ matrix.build-type == 'production' && '1' || '0' }}
161161
RCT_NEW_ARCH_ENABLED: ${{ matrix.rn-architecture == 'new' && '1' || '0' }}
162+
SENTRY_DISABLE_AUTO_UPLOAD: 'false'
162163
strategy:
163164
fail-fast: false # keeps matrix running if one fails
164165
matrix:

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ jobs:
1919
steps:
2020
- name: Get auth token
2121
id: token
22-
uses: actions/create-github-app-token@21cfef2b496dd8ef5b904c159339626a10ad380e # v1.11.6
22+
uses: actions/create-github-app-token@af35edadc00be37caa72ed9f3e6d5f7801bfdf09 # v1.11.7
2323
with:
2424
app-id: ${{ vars.SENTRY_RELEASE_BOT_CLIENT_ID }}
2525
private-key: ${{ secrets.SENTRY_RELEASE_BOT_PRIVATE_KEY }}

CHANGELOG.md

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,35 @@
1212

1313
- Add the `FeedbackButton` component that shows the Feedback Widget ([#4378](https://github.com/getsentry/sentry-react-native/pull/4378))
1414
- Add Feedback Widget theming ([#4677](https://github.com/getsentry/sentry-react-native/pull/4677))
15+
- Improve Warm App Start reporting on Android ([#4641](https://github.com/getsentry/sentry-react-native/pull/4641))
16+
- Add support for measuring Time to Initial Display for already seen routes ([#4661](https://github.com/getsentry/sentry-react-native/pull/4661))
17+
- Introduce `enableTimeToInitialDisplayForPreloadedRoutes` option to the React Navigation integration.
18+
19+
```js
20+
Sentry.reactNavigationIntegration({
21+
enableTimeToInitialDisplayForPreloadedRoutes: true,
22+
});
23+
```
24+
25+
- Add `createTimeToInitialDisplay({useFocusEffect})` and `createTimeToFullDisplay({useFocusEffect})` to allow record full display on screen focus ([#4665](https://github.com/getsentry/sentry-react-native/pull/4665))
26+
27+
### Fixes
28+
29+
- Equalize TTID and TTFD duration when TTFD manual API is called and resolved before auto TTID ([#4680](https://github.com/getsentry/sentry-react-native/pull/4680))
30+
31+
### Changes
32+
33+
- Change `gradle.projectsEvaluated` to `project.afterEvaluate` in the Sentry Gradle Plugin to fix tasks not being created when using `--configure-on-demand` ([#4687](https://github.com/getsentry/sentry-react-native/pull/4687))
34+
- Remove `SENTRY_FORCE_FOREGROUND` from Xcode Scripts as the underlying `--force-foreground` Sentry CLI is no-op since v2.37.0 ([#4689](https://github.com/getsentry/sentry-react-native/pull/4689))
35+
- TTID and TTFD use native getters instead of events to pass timestamps to the JS layer ([#4669](https://github.com/getsentry/sentry-react-native/pull/4669))
36+
37+
## 6.10.0
38+
39+
### Features
40+
1541
- Add thread information to spans ([#4579](https://github.com/getsentry/sentry-react-native/pull/4579))
1642
- Exposed `getDataFromUri` as a public API to retrieve data from a URI ([#4638](https://github.com/getsentry/sentry-react-native/pull/4638))
17-
- Improve Warm App Start reporting on Android ([#4641](https://github.com/getsentry/sentry-react-native/pull/4641))
18-
- Add experimental flags `enableExperimentalViewRenderer` and `enableFastViewRendering` to enable up to 5x times more performance in Session Replay on iOS ([#4660](https://github.com/getsentry/sentry-react-native/pull/4660))
43+
- Add `enableExperimentalViewRenderer` to enable up to 5x times more performance in Session Replay on iOS ([#4660](https://github.com/getsentry/sentry-react-native/pull/4660))
1944

2045
```js
2146
import * as Sentry from '@sentry/react-native';
@@ -24,7 +49,6 @@
2449
integrations: [
2550
Sentry.mobileReplayIntegration({
2651
enableExperimentalViewRenderer: true,
27-
enableFastViewRendering: true,
2852
}),
2953
],
3054
});
@@ -48,9 +72,9 @@
4872
- Bump Cocoa SDK from v8.45.0 to v8.48.0 ([#4621](https://github.com/getsentry/sentry-react-native/pull/4621), [#4651](https://github.com/getsentry/sentry-react-native/pull/4651), [#4662](https://github.com/getsentry/sentry-react-native/pull/4662))
4973
- [changelog](https://github.com/getsentry/sentry-cocoa/blob/main/CHANGELOG.md#8480)
5074
- [diff](https://github.com/getsentry/sentry-cocoa/compare/8.45.0...8.48.0)
51-
- Bump Android SDK from v7.22.1 to v7.22.4 ([#4675](https://github.com/getsentry/sentry-react-native/pull/4675))
52-
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7224)
53-
- [diff](https://github.com/getsentry/sentry-java/compare/7.22.1...7.22.4)
75+
- Bump Android SDK from v7.22.1 to v7.22.5 ([#4675](https://github.com/getsentry/sentry-react-native/pull/4675), [#4683](https://github.com/getsentry/sentry-react-native/pull/4683))
76+
- [changelog](https://github.com/getsentry/sentry-java/blob/main/CHANGELOG.md#7225)
77+
- [diff](https://github.com/getsentry/sentry-java/compare/7.22.1...7.22.5)
5478

5579
## 6.9.1
5680

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.9.1",
3+
"version": "6.10.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.9.1",
17+
"@sentry/react-native": "6.10.0",
1818
"@types/node": "^20.9.3",
1919
"@types/react": "^18.2.64",
2020
"appium": "2.4.1",

dev-packages/e2e-tests/patch-scripts/rn.patch.xcode.js

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,15 +32,13 @@ if (semver.satisfies(args['rn-version'], `< ${newBundleScriptRNVersion}`, { incl
3232
logger.info('Applying old bundle script patch');
3333
bundleScript = `
3434
export NODE_BINARY=node
35-
export SENTRY_CLI_EXTRA_ARGS="--force-foreground"
3635
../node_modules/@sentry/react-native/scripts/sentry-xcode.sh ../node_modules/react-native/scripts/react-native-xcode.sh
3736
`;
3837
bundleScriptRegex = /(packager|scripts)\/react-native-xcode\.sh\b/;
3938
bundlePatchRegex = /sentry-cli\s+react-native[\s-]xcode/;
4039
} else if (semver.satisfies(args['rn-version'], `>= ${newBundleScriptRNVersion}`, { includePrerelease: true })) {
4140
logger.info('Applying new bundle script patch');
4241
bundleScript = `
43-
export SENTRY_CLI_EXTRA_ARGS="--force-foreground"
4442
WITH_ENVIRONMENT="../node_modules/react-native/scripts/xcode/with-environment.sh"
4543
REACT_NATIVE_XCODE="../node_modules/react-native/scripts/react-native-xcode.sh"
4644

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.9.1",
4+
"version": "6.10.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.9.1",
3+
"version": "6.10.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.9.1",
3+
"version": "6.10.0",
44
"packages": [
55
"packages/*",
66
"dev-packages/*",

packages/core/RNSentryAndroidTester/app/build.gradle

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ dependencies {
4343
implementation 'androidx.core:core-ktx:1.7.0'
4444
implementation 'androidx.appcompat:appcompat:1.4.1'
4545
implementation 'com.google.android.material:material:1.5.0'
46+
implementation 'androidx.test:core-ktx:1.6.1'
4647
testImplementation 'junit:junit:4.13.2'
4748
testImplementation 'org.mockito:mockito-core:5.10.0'
4849
testImplementation 'org.mockito.kotlin:mockito-kotlin:5.2.1'
Lines changed: 166 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,166 @@
1+
package io.sentry.react
2+
3+
import android.app.Activity
4+
import android.content.Context
5+
import androidx.test.core.app.ApplicationProvider
6+
import com.facebook.react.bridge.ReactApplicationContext
7+
import io.sentry.android.core.BuildInfoProvider
8+
import org.junit.Assert.assertNotNull
9+
import org.junit.Assert.assertNull
10+
import org.junit.Before
11+
import org.junit.Test
12+
import org.junit.runner.RunWith
13+
import org.mockito.Mockito.mock
14+
import org.mockito.MockitoAnnotations
15+
import org.mockito.kotlin.whenever
16+
import org.robolectric.RobolectricTestRunner
17+
18+
@RunWith(RobolectricTestRunner::class)
19+
class RNSentryOnDrawReporterTest {
20+
companion object {
21+
private const val TTID_PREFIX = RNSentryOnDrawReporterManager.TTID_PREFIX
22+
private const val TTFD_PREFIX = RNSentryOnDrawReporterManager.TTFD_PREFIX
23+
private const val SPAN_ID = "test-span-id"
24+
private const val NEW_SPAN_ID = "new-test-span-id"
25+
}
26+
27+
@Before
28+
fun setUp() {
29+
MockitoAnnotations.openMocks(this)
30+
}
31+
32+
@Test
33+
fun `when parentSpanId and timeToFullDisplay are set the next render timestamp is saved`() {
34+
val reporter = createTestRNSentryOnDrawReporterView()
35+
reporter.setFullDisplay(true)
36+
reporter.setParentSpanId(SPAN_ID)
37+
38+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
39+
}
40+
41+
@Test
42+
fun `when parentSpanId and timeToInitialDisplay are set the next render timestamp is saved`() {
43+
val reporter = createTestRNSentryOnDrawReporterView()
44+
reporter.setInitialDisplay(true)
45+
reporter.setParentSpanId(SPAN_ID)
46+
47+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
48+
}
49+
50+
@Test
51+
fun `when parentSpanId and timeToFullDisplay are set the next render timestamp is saved - reversed order`() {
52+
val reporter = createTestRNSentryOnDrawReporterView()
53+
reporter.setParentSpanId(SPAN_ID)
54+
reporter.setFullDisplay(true)
55+
56+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
57+
}
58+
59+
@Test
60+
fun `when parentSpanId and timeToInitialDisplay are set the next render timestamp is saved - reversed order`() {
61+
val reporter = createTestRNSentryOnDrawReporterView()
62+
reporter.setParentSpanId(SPAN_ID)
63+
reporter.setInitialDisplay(true)
64+
65+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
66+
}
67+
68+
@Test
69+
fun `when display flag and parentSpanId changes the next full display render is saved`() {
70+
val reporter = createTestRNSentryOnDrawReporterView()
71+
reporter.setFullDisplay(true)
72+
reporter.setParentSpanId(SPAN_ID)
73+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)
74+
75+
reporter.setFullDisplay(false)
76+
reporter.setFullDisplay(true)
77+
reporter.setParentSpanId(NEW_SPAN_ID)
78+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + NEW_SPAN_ID))
79+
}
80+
81+
@Test
82+
fun `when display flag and parentSpanId changes the next initial display render is saved`() {
83+
val reporter = createTestRNSentryOnDrawReporterView()
84+
reporter.setInitialDisplay(true)
85+
reporter.setParentSpanId(SPAN_ID)
86+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)
87+
88+
reporter.setInitialDisplay(false)
89+
reporter.setInitialDisplay(true)
90+
reporter.setParentSpanId(NEW_SPAN_ID)
91+
assertNotNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + NEW_SPAN_ID))
92+
}
93+
94+
@Test
95+
fun `when parentSpanId doesn't change the next full display render is not saved`() {
96+
val reporter = createTestRNSentryOnDrawReporterView()
97+
reporter.setFullDisplay(true)
98+
reporter.setParentSpanId(SPAN_ID)
99+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)
100+
101+
reporter.setFullDisplay(false)
102+
reporter.setFullDisplay(true)
103+
reporter.setParentSpanId(SPAN_ID)
104+
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
105+
}
106+
107+
@Test
108+
fun `when parentSpanId doesn't change the next initial display render is not saved`() {
109+
val reporter = createTestRNSentryOnDrawReporterView()
110+
reporter.setInitialDisplay(true)
111+
reporter.setParentSpanId(SPAN_ID)
112+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)
113+
114+
reporter.setInitialDisplay(false)
115+
reporter.setInitialDisplay(true)
116+
reporter.setParentSpanId(SPAN_ID)
117+
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
118+
}
119+
120+
@Test
121+
fun `when display flag doesn't change the next full display render is not saved`() {
122+
val reporter = createTestRNSentryOnDrawReporterView()
123+
reporter.setFullDisplay(true)
124+
reporter.setParentSpanId(SPAN_ID)
125+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID)
126+
127+
reporter.setFullDisplay(true)
128+
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTFD_PREFIX + SPAN_ID))
129+
}
130+
131+
@Test
132+
fun `when display flag doesn't change the next initial display render is not saved`() {
133+
val reporter = createTestRNSentryOnDrawReporterView()
134+
reporter.setInitialDisplay(true)
135+
reporter.setParentSpanId(SPAN_ID)
136+
RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID)
137+
138+
reporter.setInitialDisplay(true)
139+
assertNull(RNSentryTimeToDisplay.popTimeToDisplayFor(TTID_PREFIX + SPAN_ID))
140+
}
141+
142+
class TestRNSentryOnDrawReporterView(
143+
context: Context,
144+
reactContext: ReactApplicationContext,
145+
buildInfo: BuildInfoProvider,
146+
) : RNSentryOnDrawReporterManager.RNSentryOnDrawReporterView(context, reactContext, buildInfo) {
147+
override fun registerForNextDraw(
148+
activity: Activity,
149+
callback: Runnable,
150+
buildInfo: BuildInfoProvider,
151+
) {
152+
callback.run()
153+
}
154+
}
155+
156+
private fun createTestRNSentryOnDrawReporterView(): TestRNSentryOnDrawReporterView =
157+
TestRNSentryOnDrawReporterView(ApplicationProvider.getApplicationContext(), mockReactContext(), mockBuildInfo())
158+
159+
private fun mockReactContext(): ReactApplicationContext {
160+
val reactContext = mock<ReactApplicationContext>()
161+
whenever(reactContext.getCurrentActivity()).thenReturn(mock<Activity>())
162+
return reactContext
163+
}
164+
165+
private fun mockBuildInfo(): BuildInfoProvider = mock()
166+
}
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
package io.sentry.react
2+
3+
import org.junit.Assert.assertEquals
4+
import org.junit.Assert.assertNotNull
5+
import org.junit.Assert.assertNull
6+
import org.junit.Before
7+
import org.junit.Test
8+
import org.junit.runner.RunWith
9+
import org.junit.runners.JUnit4
10+
11+
@RunWith(JUnit4::class)
12+
class RNSentryTimeToDisplayTest {
13+
companion object {
14+
val TEST_ID = "test-id"
15+
val TEST_VAL = 123.4
16+
}
17+
18+
@Before
19+
fun setUp() {
20+
}
21+
22+
@Test
23+
fun `puts and pops record`() {
24+
RNSentryTimeToDisplay.putTimeToDisplayFor(TEST_ID, TEST_VAL)
25+
26+
val firstPop = RNSentryTimeToDisplay.popTimeToDisplayFor(TEST_ID)
27+
val secondPop = RNSentryTimeToDisplay.popTimeToDisplayFor(TEST_ID)
28+
29+
assertEquals(firstPop, TEST_VAL, 0.0)
30+
assertNull(secondPop)
31+
}
32+
33+
@Test
34+
fun `removes oldes entry when full`() {
35+
val maxSize = RNSentryTimeToDisplay.ENTRIES_MAX_SIZE + 1
36+
for (i in 1..maxSize) {
37+
RNSentryTimeToDisplay.putTimeToDisplayFor("$TEST_ID-$i", i.toDouble())
38+
}
39+
40+
val oldestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-1")
41+
val secondOldestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-2")
42+
val newestEntry = RNSentryTimeToDisplay.popTimeToDisplayFor("$TEST_ID-$maxSize")
43+
44+
assertNull(oldestEntry)
45+
assertNotNull(secondOldestEntry)
46+
assertNotNull(newestEntry)
47+
}
48+
}

0 commit comments

Comments
 (0)