From 2d64b2494b166df315549ccf1c7f4c936e47efa1 Mon Sep 17 00:00:00 2001 From: Vit Horacek <36083550+mountiny@users.noreply.github.com> Date: Mon, 15 May 2023 14:43:30 +0200 Subject: [PATCH] Revert "[No QA] Use Ping endpoint for internet reachability instead of API root" --- ios/Podfile.lock | 4 ++-- package-lock.json | 11 ++++------- package.json | 2 +- src/libs/NetworkConnection.js | 11 +---------- 4 files changed, 8 insertions(+), 20 deletions(-) diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 926e790ad79d..f0d6720080e8 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -516,7 +516,7 @@ PODS: - React-Core - react-native-key-command (1.0.0): - React-Core - - react-native-netinfo (9.3.9): + - react-native-netinfo (8.3.1): - React-Core - react-native-pdf (6.6.2): - React-Core @@ -1085,7 +1085,7 @@ SPEC CHECKSUMS: react-native-image-manipulator: c48f64221cfcd46e9eec53619c4c0374f3328a56 react-native-image-picker: c33d4e79f0a14a2b66e5065e14946ae63749660b react-native-key-command: 0b3aa7c9f5c052116413e81dce33a3b2153a6c5d - react-native-netinfo: 22c082970cbd99071a4e5aa7a612ac20d66b08f0 + react-native-netinfo: 1a6035d3b9780221d407c277ebfb5722ace00658 react-native-pdf: 33c622cbdf776a649929e8b9d1ce2d313347c4fa react-native-performance: 224bd53e6a835fda4353302cf891d088a0af7406 react-native-plaid-link-sdk: 9eb0f71dad94b3bdde649c7a384cba93024af46c diff --git a/package-lock.json b/package-lock.json index 29c6ac954572..a4844330fc58 100644 --- a/package-lock.json +++ b/package-lock.json @@ -23,7 +23,7 @@ "@react-native-camera-roll/camera-roll": "5.4.0", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/datetimepicker": "^3.5.2", - "@react-native-community/netinfo": "^9.3.9", + "@react-native-community/netinfo": "^8.3.0", "@react-native-community/progress-bar-android": "^1.0.4", "@react-native-community/progress-view": "^1.2.3", "@react-native-firebase/analytics": "^12.3.0", @@ -7086,9 +7086,8 @@ "license": "MIT" }, "node_modules/@react-native-community/netinfo": { - "version": "9.3.9", - "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-9.3.9.tgz", - "integrity": "sha512-L9f8OjX5Fwh5CdP4ygDPa6iQCJJ4tAtXiFuQp6EG4/sdSXDqOXaehAhJrZAN8P8Lztnf8YN8p836GmZuBCrY+A==", + "version": "8.3.1", + "license": "MIT", "peerDependencies": { "react-native": ">=0.59" } @@ -46433,9 +46432,7 @@ "dev": true }, "@react-native-community/netinfo": { - "version": "9.3.9", - "resolved": "https://registry.npmjs.org/@react-native-community/netinfo/-/netinfo-9.3.9.tgz", - "integrity": "sha512-L9f8OjX5Fwh5CdP4ygDPa6iQCJJ4tAtXiFuQp6EG4/sdSXDqOXaehAhJrZAN8P8Lztnf8YN8p836GmZuBCrY+A==", + "version": "8.3.1", "requires": {} }, "@react-native-community/progress-bar-android": { diff --git a/package.json b/package.json index 7a7a1cfe3b0b..7f5201817cfd 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@react-native-camera-roll/camera-roll": "5.4.0", "@react-native-community/clipboard": "^1.5.1", "@react-native-community/datetimepicker": "^3.5.2", - "@react-native-community/netinfo": "^9.3.9", + "@react-native-community/netinfo": "^8.3.0", "@react-native-community/progress-bar-android": "^1.0.4", "@react-native-community/progress-view": "^1.2.3", "@react-native-firebase/analytics": "^12.3.0", diff --git a/src/libs/NetworkConnection.js b/src/libs/NetworkConnection.js index 67baec1ad3ed..f3b16927becc 100644 --- a/src/libs/NetworkConnection.js +++ b/src/libs/NetworkConnection.js @@ -82,16 +82,7 @@ function subscribeToNetInfo() { // When App is served locally (or from Electron) this address is always reachable - even offline // Using the API url ensures reachability is tested over internet reachabilityUrl: `${CONFIG.EXPENSIFY.DEFAULT_API_ROOT}api`, - reachabilityMethod: 'GET', - reachabilityTest: (response) => { - if (!response.ok) { - return Promise.resolve(false); - } - return response - .json() - .then((json) => Promise.resolve(json.jsonCode === 200)) - .catch(() => Promise.resolve(false)); - }, + reachabilityTest: (response) => Promise.resolve(response.status === 200), // If a check is taking longer than this time we're considered offline reachabilityRequestTimeout: CONST.NETWORK.MAX_PENDING_TIME_MS,