Skip to content

Commit fa21904

Browse files
ahmedAlaaInstabugYoussefFouadda7medevkholood-eamzelzoghbi
authored
fix: prevent not sending the unSent xhrRequest (#1365)
* Release:v14.1.0 (#1338) * feat(example): add features and buttons implementation (#1280) Jira ID: RL-224 * fix: replace thrown errors with logs (#1220) * fix: Replace Thrown Errors with Logs sss chore(ios): bump sdk to v13.1.0 (#1227) * chore(ios): bump ios sdk v13.1.0 * chore(ios): bump ios sdk v13.1.0 * chore(ios): bump ios sdk v13.1.0 chore(android): bump sdk to v13.1.1 (#1228) * chore(android): bump android sdk v13.1.1 feat: enhance non-fatals support (#1194) * add non fatal api --------- Co-authored-by: Ahmed Mahmoud <[email protected]> fix: read env variable in sourcemap (#1232) * fix sourcemap issue * fix sourcemap issue * fix sourcemap issue * Update typo in CHANGELOG.md --------- Co-authored-by: Andrew Amin <[email protected]> Release:v13.1.1 (#1231) * release/v13.1.1 * Update CHANGELOG.md Update CHANGELOG.md chore(deps): bump @babel/traverse in /examples/default Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.22.8 to 7.24.6. - [Release notes](https://github.com/babel/babel/releases) - [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md) - [Commits](https://github.com/babel/babel/commits/v7.24.6/packages/babel-traverse) --- updated-dependencies: - dependency-name: "@babel/traverse" dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> chore(deps): bump follow-redirects from 1.15.2 to 1.15.6 Bumps [follow-redirects](https://github.com/follow-redirects/follow-redirects) from 1.15.2 to 1.15.6. - [Release notes](https://github.com/follow-redirects/follow-redirects/releases) - [Commits](follow-redirects/follow-redirects@v1.15.2...v1.15.6) --- updated-dependencies: - dependency-name: follow-redirects dependency-type: indirect ... Signed-off-by: dependabot[bot] <[email protected]> fix: cont work after logging fix(android): change parameters used in inner class to final (#1239) chore(android): bump sdk to v13.2.0 (#1245) * chore(android): bump sdk to v13.2.0 * chore: update changelog chore(ios): bump sdk to v13.2.0 (#1246) release: v13.2.0 (#1247) chore: resolve issues in changelog (#1249) feat(example): add apm screen (#1141) fix(android): resolve an OOM in network logs (#1244) fix(android): APM network logging(#1253) * fix(android): add W3C External Trace Attributes placeholder * chore: add CHANGLOG * chore: add CHANGLOG * fix: remove ios sub module feat: export upload utils (#1252) chore(example): remove flipper (#1259) fix(android): pass network start time in microseconds (#1260) * fix: network timestamp in android side * fix: PR comments Co-authored-by: Ahmed Elrefaey <[email protected]> --------- Co-authored-by: Ahmed Elrefaey <[email protected]> feat: support feature flags with variants (#1230) Jira ID: MOB-14684 --------- Co-authored-by: Ahmed Elrefaey <[email protected]> chore(android): bump android sdk to v13.3.0 (#1261) chore(ios): bump sdk to v13.3.0 (#1262) release: v13.3.0 (#1263) chore: remove duplicate app flows entries in changelog (#1264) chore: remove duplicate execution traces deprecation in changelog (#1265) feat: navigation tracking support with expo router (#1270) * feat: add screen tracker on screen change listener and tests * feat (example): add screen change listener chore: enhance expo router tracking support (#1272) ci: generalize enterprise releases (#1275) ci: run tests before enterprise releases (#1271) ci: publish snapshots to npm (#1274) fix: PR comments fix(ios): network log empty response body (#1273) fix: drop non-error objects when reporting errors (#1279) * Fix: omitted non-error objects when logging errors * ci: publish snapshots to npm (#1274) * Fix: omitted non-error objects when logging errors * fix: use warn instead of logs Co-authored-by: Ahmed Elrefaey <[email protected]> * Update CHANGELOG.md Co-authored-by: Ahmed Elrefaey <[email protected]> * fix: merge issues --------- Co-authored-by: Ahmed Elrefaey <[email protected]> feat: capture client error in the network interceptor (#1257) * feat/support-capture-client-error-in-xhr-requests --------- Co-authored-by: Abdelhamid Nasser <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> fix: APM test cases * fix: APM test cases * fix test cases * fix: PR comments * fix: PR comments * fix: PR comments * refactor(example): upgrade to react native 0.75.4 (#1302) * chore: upgrade dependencies * refactor(example): upgrade to react native 0.75.4 * chore: integrate android sdk v14 snapshot * ci: install cocoapods 1.14 * ci: upgrade xcode to 15.4 * chore: remove .xcode.env.local * ci: install cocoapods into usr/local/bin * ci: fix empty jacoco report issue * Release: v14.0.0 (#1312) * Release : v14.0.0 * Release : v14.0.0 * Release : v14.0.0 * feat: add session sync callback (#1292) * feat(android): add session sync callback (#1281) * feat(android): add SRSyncCallback * feat: implement and test syncCallback CP side * feat(example): use SRSyncCallback in example app * ci: fix tests * fix: export session data type * fix(example): use session data type * fix(android):remove data modifier * fix(android): add property modifiers * fix(android): update test case * fix: enhance test case * fix: update session data type * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * fix: assert evaluate sync returns correct value * fix: import type * fix: cleanup * chore: update js doc * fix: typo * fix: follow interface naming convention * fix: update type * fix: refactor syncCallback * fix: default syncing session to true * fix: convert network logs to readable array * chore: add discriptive comment * chore: use readable map for session metadata * fix: setSyncCallback should sync in case of exception * fix: move SessionMetadata to models * fix: update SessionMetadata type import * fix: report bug e2e test --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * feat(ios): add session sync callback (#1282) * feat(android): add SRSyncCallback * feat: implement and test syncCallback CP side * feat(example): use SRSyncCallback in example app * ci: fix tests * fix: export session data type * fix(example): use session data type * fix(android):remove data modifier * fix(android): add property modifiers * fix(android): update test case * fix: enhance test case * fix(ios): update network log signature * chore(ios): integrate dynamic sampling snapshot * fix:update IOS network log unit test * fix: update session metadata * feat(ios): add setSyncCallback * fix: pod.lock file * fix: update session data type * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * fix: enhance test case * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * feat(ios): add launchType metadata to session syncCallback * fix: add unknown type to launch types * fix: assert evaluate sync returns correct value * fix: import type * fix: cleanup * chore: update js doc * fix: typo * fix: follow interface naming convention * fix: update type * fix: refactor syncCallback * fix: default syncing session to true * fix: convert network logs to readable array * chore: add discriptive comment * chore: use readable map for session metadata * fix: setSyncCallback should sync in case of exception * fix: move SessionMetadata to models * fix: update SessionMetadata type import * fix: report bug e2e test * chore (ios): update snapshot * chore (ios): refactor callback * fix: return network logs * chore: update podfile.lock * chore: fix formatting * chore: revert Podfile.lock * chore: fix ci * fix: launchType typo * fix: update class sessionEvaluationCompletion atomicity * chore: enhance syncCallback formatting * chore: update evaluateSync formatting * fix: fix test SetSyncCallback * fix: update getNetworkLogsArray return value --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * Revert "fix(ios): update network log signature" This reverts commit 8d9036e. * chore(ios): update snapshot * fix: ios network logging test after reverting * fix: convert sendEvent arg from writable to readable map * chore(android): update snapshot * fix(android): refactor getSessionMetadataMap to tolerate null values * fix(ios): update fulfill exception wait time in test * fix(android): convert session metadat map to readable map * chore: update docs * fix: remove hot launch type * fix: increase timeout expectation in test case * Revert "fix: increase timeout expectation in test case" This reverts commit be32acd. * feat(example): add features and buttons implementation (#1280) Jira ID: RL-224 * fix(android): add unknown launch type * chore: update documentation * feat: upgrade to 14.0.0 * feat: upgrade to 14.0.0 * feat: upgrade to 14.0.0 * merge dev * merge dev * merge dev * fix: test case --------- Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: YoussefFouadd <[email protected]> Co-authored-by: Ahmed alaa <[email protected]> * master-on-dev (#1316) Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> * chore: update release date (#1320) * feat: add w3c traceparent header injection (#1288) * feat(example): add apm screen (#1141) * fix(android): resolve an OOM in network logs (#1244) * fix(android): APM network logging(#1253) * fix(android): add W3C External Trace Attributes placeholder * chore: add CHANGLOG * chore: add CHANGLOG * fix: remove ios sub module * fix: use correct diff link for v13.0.0, v12.9.0 releases (#1198) * feat(ios): read env vars from .xcode.env in sourcemaps script (#1200) * feat(ios): read env vars from .xcode.env in sourcemaps script * chore: update xcode project * chore: update changelog * chore/update-podfile.lock * feat: add w3c header generator * ci:fix lint * ci:fix ios tests * feat:update header format * feat:update header format test case title * feat:Inject the W3C Header to Network Requests * ci:fix lint * feat:remove tracestate * feat: get feature flags from IOS * ci: fix ios test * fix: modify function naming * fix: update APM test cases * fix: update native test cases naming * feat(ios): w3c logs mapping * fix: export number partial id * fix: modify partial id generator function * fix: modify partial id generator test cases * feat(example): add network request generators buttons * ci: fix lint * ci(example): add missing import * feat(android): map apm network logs * feat(android): add W3C native modules & tests * feat: map w3c android native modules and test * feat: register w3c feature change listener * feat: add feature flags * feat: call updated feature flags * fix: update object assigning * fix: remove comment * fix: modify test cases naming * fix: generated header injection * fix: fix variable neames * fix: update test cases * fix(android): caught header null string * fix: update network log interface * fix (example): remove redundant button * feat (example): add Enable/Disable APM buttons * fix: add w3c Attributes to network logs tests * fix: fix imports * feat(android) : add w3c attributes to APM network Logs * chore: remove flipper * fix: adjust spacing * fix: update test case * feat: migrate-Feature-Flag-APM-method-to-Core * fix: js testcases * fix: js testcases * fix: js testcases * feat: add migrate APM into core in ios section * fix: js testcases * feat: add migrate APM into core in ios section * feat: add migrate APM into core in ios section * fix: Pr comments * fix: PR comment * fix: Pr comments * fix: added changelog item * fix: feature flag listener * fix: feature flag listener * feat: migrate w3c flags to APM core * feat(example): add apm screen (#1141) * fix(android): resolve an OOM in network logs (#1244) * fix(android): APM network logging(#1253) * fix(android): add W3C External Trace Attributes placeholder * chore: add CHANGLOG * chore: add CHANGLOG * fix: remove ios sub module * feat: export upload utils (#1252) * chore(example): remove flipper (#1259) * fix(android): pass network start time in microseconds (#1260) * fix: network timestamp in android side * fix: PR comments Co-authored-by: Ahmed Elrefaey <[email protected]> --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * feat: support feature flags with variants (#1230) Jira ID: MOB-14684 --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * chore(android): bump android sdk to v13.3.0 (#1261) * chore(ios): bump sdk to v13.3.0 (#1262) * release: v13.3.0 (#1263) * chore: remove duplicate app flows entries in changelog (#1264) * chore: remove duplicate execution traces deprecation in changelog (#1265) * feat: navigation tracking support with expo router (#1270) * feat: add screen tracker on screen change listener and tests * feat (example): add screen change listener * chore: enhance expo router tracking support (#1272) * ci: generalize enterprise releases (#1275) * ci: run tests before enterprise releases (#1271) * ci: publish snapshots to npm (#1274) * fix(ios): network log empty response body (#1273) * fix: drop non-error objects when reporting errors (#1279) * Fix: omitted non-error objects when logging errors * ci: publish snapshots to npm (#1274) * Fix: omitted non-error objects when logging errors * fix: use warn instead of logs Co-authored-by: Ahmed Elrefaey <[email protected]> * Update CHANGELOG.md Co-authored-by: Ahmed Elrefaey <[email protected]> * fix: merge issues --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * feat: capture client error in the network interceptor (#1257) * feat/support-capture-client-error-in-xhr-requests --------- Co-authored-by: Abdelhamid Nasser <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> * fix: merge issues * fix: networkLogIOS test case * fix: merge issues * fix: merge issues * fix: merge issues * fix: merge issues * fix: merge issues * fix: remove logs * fix: refactore networkLogAndroid arguments * fix: merge issues * fix: merge issues * fix: move W3cExternalTraceAttributes to models * fix: return expected value type from bridge * fix: refactor method call * fix: refactor method name * fix: return expected value types of w3c flags * chore: refactor constant names * fix: pod file * fix(android): fix w3c caught header * fix (android): reporting network logs upon disabling w3c main feature flag * chore: add changelog --------- Co-authored-by: Abdelhamid Nasser <[email protected]> Co-authored-by: kholood <[email protected]> Co-authored-by: Ahmed alaa <[email protected]> Co-authored-by: ahmed alaa <[email protected]> * Adding buttons to the sample app (#1311) * feat(example): add webviews to the sample app (#1310) * Adding WebViews to sample app * Fixing Pods issue * Fixing CI * feat: exclude DEV server from network logs (#1307) * feat: exclude dev server * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * feat: exclude DEV server url from network logs * merge dev * fix: Adjust logging behavior based on the debugLogLevel. (#1319) * refactor(example): upgrade to react native 0.75.4 (#1302) * chore: upgrade dependencies * refactor(example): upgrade to react native 0.75.4 * chore: integrate android sdk v14 snapshot * ci: install cocoapods 1.14 * ci: upgrade xcode to 15.4 * chore: remove .xcode.env.local * ci: install cocoapods into usr/local/bin * ci: fix empty jacoco report issue * Release: v14.0.0 (#1312) * Release : v14.0.0 * Release : v14.0.0 * Release : v14.0.0 * feat: add session sync callback (#1292) * feat(android): add session sync callback (#1281) * feat(android): add SRSyncCallback * feat: implement and test syncCallback CP side * feat(example): use SRSyncCallback in example app * ci: fix tests * fix: export session data type * fix(example): use session data type * fix(android):remove data modifier * fix(android): add property modifiers * fix(android): update test case * fix: enhance test case * fix: update session data type * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * fix: assert evaluate sync returns correct value * fix: import type * fix: cleanup * chore: update js doc * fix: typo * fix: follow interface naming convention * fix: update type * fix: refactor syncCallback * fix: default syncing session to true * fix: convert network logs to readable array * chore: add discriptive comment * chore: use readable map for session metadata * fix: setSyncCallback should sync in case of exception * fix: move SessionMetadata to models * fix: update SessionMetadata type import * fix: report bug e2e test --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * feat(ios): add session sync callback (#1282) * feat(android): add SRSyncCallback * feat: implement and test syncCallback CP side * feat(example): use SRSyncCallback in example app * ci: fix tests * fix: export session data type * fix(example): use session data type * fix(android):remove data modifier * fix(android): add property modifiers * fix(android): update test case * fix: enhance test case * fix(ios): update network log signature * chore(ios): integrate dynamic sampling snapshot * fix:update IOS network log unit test * fix: update session metadata * feat(ios): add setSyncCallback * fix: pod.lock file * fix: update session data type * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * fix: enhance test case * fix: add more session metadata to setSyncCallback * fix: update syncCallback test * feat: add launchType to session metadata for setSyncCallback * fix: import type * feat(ios): add launchType metadata to session syncCallback * fix: add unknown type to launch types * fix: assert evaluate sync returns correct value * fix: import type * fix: cleanup * chore: update js doc * fix: typo * fix: follow interface naming convention * fix: update type * fix: refactor syncCallback * fix: default syncing session to true * fix: convert network logs to readable array * chore: add discriptive comment * chore: use readable map for session metadata * fix: setSyncCallback should sync in case of exception * fix: move SessionMetadata to models * fix: update SessionMetadata type import * fix: report bug e2e test * chore (ios): update snapshot * chore (ios): refactor callback * fix: return network logs * chore: update podfile.lock * chore: fix formatting * chore: revert Podfile.lock * chore: fix ci * fix: launchType typo * fix: update class sessionEvaluationCompletion atomicity * chore: enhance syncCallback formatting * chore: update evaluateSync formatting * fix: fix test SetSyncCallback * fix: update getNetworkLogsArray return value --------- Co-authored-by: Ahmed Elrefaey <[email protected]> * Revert "fix(ios): update network log signature" This reverts commit 8d9036e. * chore(ios): update snapshot * fix: ios network logging test after reverting * fix: convert sendEvent arg from writable to readable map * chore(android): update snapshot * fix(android): refactor getSessionMetadataMap to tolerate null values * fix(ios): update fulfill exception wait time in test * fix(android): convert session metadat map to readable map * chore: update docs * fix: remove hot launch type * fix: increase timeout expectation in test case * Revert "fix: increase timeout expectation in test case" This reverts commit be32acd. * feat(example): add features and buttons implementation (#1280) Jira ID: RL-224 * fix(android): add unknown launch type * chore: update documentation * feat: upgrade to 14.0.0 * feat: upgrade to 14.0.0 * feat: upgrade to 14.0.0 * merge dev * merge dev * merge dev * fix: test case --------- Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: YoussefFouadd <[email protected]> Co-authored-by: Ahmed alaa <[email protected]> * master-on-dev (#1316) Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> * fix: adjust logging with debuglogLevel * chore: update release date (#1320) --------- Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> Co-authored-by: YoussefFouadd <[email protected]> --------- Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> Co-authored-by: YoussefFouadd <[email protected]> * Release:14.1.0 (#1335) * release: 14.1.0 * release: 14.1.0 * release: v14.1.0 * release: v14.1.0 * release: v14.1.0 --------- Co-authored-by: YoussefFouadd <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> Co-authored-by: Abdelhamid Nasser <[email protected]> * fix: prevent not sending the unSent xhrRequest * fix: prevent not sending the unSent xhrRequest * feat: add netinfo check in network screen * feat: add change log * feat: add change log * ci: fix ci running * ci: fix ci running --------- Co-authored-by: YoussefFouadd <[email protected]> Co-authored-by: Ahmed Elrefaey <[email protected]> Co-authored-by: kholood <[email protected]> Co-authored-by: Mohamed Zakaria El-Zoghbi <[email protected]> Co-authored-by: Abdelhamid Nasser <[email protected]> Co-authored-by: AyaMahmoud148 <[email protected]>
1 parent a65cdd0 commit fa21904

File tree

6 files changed

+27
-5
lines changed

6 files changed

+27
-5
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@
88

99
- Add support for xCode 16. ([#1370](https://github.com/Instabug/Instabug-React-Native/pull/1370))
1010

11+
### Fixed
12+
13+
- Not sending the inComplete xhrRequest. ([#1365](https://github.com/Instabug/Instabug-React-Native/pull/1365))
14+
1115
- Added more search capabilities to the find-token.sh script. e.g., searching in .env file for react config. [#1366](https://github.com/Instabug/Instabug-React-Native/pull/1366)
1216

1317
## [14.3.0](https://github.com/Instabug/Instabug-React-Native/compare/v14.1.0...14.3.0)

examples/default/ios/Podfile.lock

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1296,6 +1296,8 @@ PODS:
12961296
- React-Core
12971297
- react-native-maps (1.10.3):
12981298
- React-Core
1299+
- react-native-netinfo (11.4.1):
1300+
- React-Core
12991301
- react-native-safe-area-context (4.12.0):
13001302
- React-Core
13011303
- react-native-slider (4.5.5):
@@ -1806,6 +1808,7 @@ DEPENDENCIES:
18061808
- react-native-config (from `../node_modules/react-native-config`)
18071809
- react-native-google-maps (from `../node_modules/react-native-maps`)
18081810
- react-native-maps (from `../node_modules/react-native-maps`)
1811+
- "react-native-netinfo (from `../node_modules/@react-native-community/netinfo`)"
18091812
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
18101813
- "react-native-slider (from `../node_modules/@react-native-community/slider`)"
18111814
- react-native-webview (from `../node_modules/react-native-webview`)
@@ -1935,6 +1938,8 @@ EXTERNAL SOURCES:
19351938
:path: "../node_modules/react-native-maps"
19361939
react-native-maps:
19371940
:path: "../node_modules/react-native-maps"
1941+
react-native-netinfo:
1942+
:path: "../node_modules/@react-native-community/netinfo"
19381943
react-native-safe-area-context:
19391944
:path: "../node_modules/react-native-safe-area-context"
19401945
react-native-slider:
@@ -2055,6 +2060,7 @@ SPEC CHECKSUMS:
20552060
react-native-config: 8f7283449bbb048902f4e764affbbf24504454af
20562061
react-native-google-maps: 1bcc1f9f13f798fcf230db7fe476f3566d0bc0a3
20572062
react-native-maps: 72a8a903f8a1b53e2c777ba79102078ab502e0bf
2063+
react-native-netinfo: f0a9899081c185db1de5bb2fdc1c88c202a059ac
20582064
react-native-safe-area-context: 142fade490cbebbe428640b8cbdb09daf17e8191
20592065
react-native-slider: 4a0f3386a38fc3d2d955efc515aef7096f7d1ee4
20602066
react-native-webview: c0b91a4598bd54e9fbc70353aebf1e9bab2e5bb9

examples/default/package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
},
1212
"dependencies": {
1313
"@react-native-clipboard/clipboard": "^1.14.3",
14+
"@react-native-community/netinfo": "^11.4.1",
1415
"@react-native-community/slider": "^4.5.5",
1516
"@react-navigation/bottom-tabs": "^6.5.7",
1617
"@react-navigation/native": "^6.1.6",

examples/default/src/screens/apm/NetworkScreen.tsx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,16 @@ import axios from 'axios';
1111
import type { HomeStackParamList } from '../../navigation/HomeStack';
1212
import type { NativeStackScreenProps } from '@react-navigation/native-stack';
1313
import { ListTile } from '../../components/ListTile';
14+
import { useNetInfo } from '@react-native-community/netinfo';
1415

1516
export const NetworkScreen: React.FC<
1617
NativeStackScreenProps<HomeStackParamList, 'NetworkTraces'>
1718
> = ({ navigation }) => {
1819
const [endpointUrl, setEndpointUrl] = useState('');
1920
const { width, height } = useWindowDimensions();
21+
22+
const { isConnected } = useNetInfo();
23+
2024
const defaultRequestUrl = 'https://jsonplaceholder.typicode.com/posts/1';
2125
const imageUrls = [
2226
'https://fastly.picsum.photos/id/57/200/300.jpg?hmac=l908G1qVr4r7dP947-tak2mY8Vvic_vEYzCXUCKKskY',
@@ -129,6 +133,7 @@ export const NetworkScreen: React.FC<
129133
/>
130134
<CustomButton onPress={() => refetch} title="Reload GraphQL" />
131135
<View>
136+
<Text>{isConnected ? 'Network is Connected' : 'Network is not connected'}</Text>
132137
{isLoading && <Text>Loading...</Text>}
133138
{isSuccess && <Text>GraphQL Data: {data.country.emoji}</Text>}
134139
{isError && <Text>Error!</Text>}

examples/default/yarn.lock

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2041,6 +2041,11 @@
20412041
prompts "^2.4.2"
20422042
semver "^7.5.2"
20432043

2044+
"@react-native-community/netinfo@^11.4.1":
2045+
version "11.4.1"
2046+
resolved "https://registry.yarnpkg.com/@react-native-community/netinfo/-/netinfo-11.4.1.tgz#a3c247aceab35f75dd0aa4bfa85d2be5a4508688"
2047+
integrity sha512-B0BYAkghz3Q2V09BF88RA601XursIEA111tnc2JOaN7axJWmNefmfjZqw/KdSxKZp7CZUuPpjBmz/WCR9uaHYg==
2048+
20442049
"@react-native-community/slider@^4.5.5":
20452050
version "4.5.5"
20462051
resolved "https://registry.yarnpkg.com/@react-native-community/slider/-/slider-4.5.5.tgz#d70fc5870477760033769bbd6625d57e7d7678b2"

src/utils/XhrNetworkInterceptor.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ const getTraceparentHeader = async (networkData: NetworkData) => {
8585
});
8686
};
8787

88-
export const injectHeaders = async (
88+
export const injectHeaders = (
8989
networkData: NetworkData,
9090
featureFlags: {
9191
isW3cExternalTraceIDEnabled: boolean;
@@ -113,10 +113,7 @@ export const injectHeaders = async (
113113
return injectionMethodology;
114114
};
115115

116-
const identifyCaughtHeader = async (
117-
networkData: NetworkData,
118-
isW3cCaughtHeaderEnabled: boolean,
119-
) => {
116+
const identifyCaughtHeader = (networkData: NetworkData, isW3cCaughtHeaderEnabled: boolean) => {
120117
if (isW3cCaughtHeaderEnabled) {
121118
networkData.w3cCaughtHeader = networkData.requestHeaders.traceparent;
122119
return networkData.requestHeaders.traceparent;
@@ -314,6 +311,10 @@ export default {
314311
if (traceparent) {
315312
this.setRequestHeader('Traceparent', traceparent);
316313
}
314+
if (this.readyState === this.UNSENT) {
315+
return; // Prevent sending the request if not opened
316+
}
317+
317318
originalXHRSend.apply(this, [data]);
318319
};
319320
isInterceptorEnabled = true;

0 commit comments

Comments
 (0)