Skip to content

Commit 50972b1

Browse files
committed
Fixes #125, version bump
1 parent 011459c commit 50972b1

File tree

7 files changed

+12
-11
lines changed

7 files changed

+12
-11
lines changed

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ withNetworkConnectivity(config: Config): (WrappedComponent) => EnhancedComponent
7272
type Config = {
7373
withRedux?: boolean = false,
7474
timeout?: number = 3000,
75-
pingServerUrl?: string = 'http://www.google.com/',
75+
pingServerUrl?: string = 'https://www.google.com/',
7676
withExtraHeadRequest?: boolean = true,
7777
checkConnectionInterval?: number = 0,
7878
checkIntervalOfflineOnly?: boolean = false,
@@ -86,7 +86,7 @@ type Config = {
8686

8787
`timeout`: amount of time (in ms) that the component should wait for the ping response. Defaults to 3s.
8888

89-
`pingServerUrl`: remote server to ping to. It defaults to http://www.google.com/ since it's probably one the most stable servers out there, but you can provide your own if needed.
89+
`pingServerUrl`: remote server to ping to. It defaults to https://www.google.com/ since it's probably one the most stable servers out there, but you can provide your own if needed.
9090

9191
`withExtraHeadRequest`: flag that denotes whether the extra ping check will be performed or not. Defaults to `true`.
9292

@@ -119,7 +119,7 @@ React component that accepts a function as children. It allows you to decouple y
119119
type Props = {
120120
children: (isConnected: boolean) => React$Element<any>
121121
timeout?: number = 3000,
122-
pingServerUrl?: string = 'http://www.google.com/',
122+
pingServerUrl?: string = 'https://www.google.com/',
123123
withExtraHeadRequest?: boolean = true,
124124
}
125125
```
@@ -266,7 +266,7 @@ type Config = {
266266
This is the setup you need to put in place for libraries such as `redux-saga` or `redux-observable`, which rely on plain actions being dispatched to trigger async flow:
267267

268268
`regexActionType`: regular expression to indicate the action types to be intercepted in offline mode.
269-
By default it's configured to intercept actions for fetching data following the Redux [convention](http://redux.js.org/docs/advanced/AsyncActions.html). That means that it will intercept actions with types such as `FETCH_USER_ID_REQUEST`, `FETCH_PRODUCTS_REQUEST` etc.
269+
By default it's configured to intercept actions for fetching data following the Redux [convention](https://redux.js.org/docs/advanced/AsyncActions.html). That means that it will intercept actions with types such as `FETCH_USER_ID_REQUEST`, `FETCH_PRODUCTS_REQUEST` etc.
270270

271271
`actionTypes`: array with additional action types to intercept that don't fulfil the RegExp criteria. For instance, it's useful for actions that carry along refreshing data, such as `REFRESH_LIST`.
272272

@@ -419,7 +419,7 @@ fetchData.meta = {
419419
Utility function that allows you to query for internet connectivity on demand. If you have integrated this library with redux, you can then dispatch a `CONNECTION_CHANGE` action type to inform the `network` reducer accordingly and keep it up to date. Check the example below.
420420

421421
```js
422-
checkInternetConnection(timeout?: number = 3000, url?: string = 'http://www.google.com/'): Promise<boolean>
422+
checkInternetConnection(timeout?: number = 3000, url?: string = 'https://www.google.com/'): Promise<boolean>
423423
```
424424

425425
##### Example

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-native-offline",
3-
"version": "3.13.0",
3+
"version": "3.14.0",
44
"description": "Handy toolbelt to deal with offline mode in React Native applications. Cross-platform, provides a smooth redux integration.",
55
"main": "./src/index.js",
66
"author": "Raul Gomez Acuña <raulgdeveloper@gmail.com> (https://github.com/rgommezz)",

src/ConnectivityRenderer.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class ConnectivityRenderer extends Component<DefaultProps, Props, State> {
3030

3131
static defaultProps: DefaultProps = {
3232
timeout: 3000,
33-
pingServerUrl: 'http://www.google.com/',
33+
pingServerUrl: 'https://www.google.com/',
3434
withExtraHeadRequest: true,
3535
};
3636

src/checkInternetAccess.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import type { HTTPMethod } from './types';
44

55
export default function checkInternetAccess(
66
timeout: number = 3000,
7-
url: string = 'http://www.google.com/',
7+
url: string = 'https://www.google.com/',
88
method: HTTPMethod = 'HEAD',
99
): Promise<boolean> {
1010
return new Promise((resolve: (value: boolean) => void) => {

src/checkInternetConnection.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ import checkInternetAccess from './checkInternetAccess';
1313
*/
1414
export default function checkInternetConnection(
1515
timeout: number = 3000,
16-
url: string = 'http://www.google.com/',
16+
url: string = 'https://www.google.com/',
1717
): Promise<boolean> {
1818
let connectionChecked: Promise<boolean>;
1919
if (Platform.OS === 'ios') {

src/makeHttpRequest.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ export default function makeHttpRequest({
3838

3939
xhr.open(method, url);
4040
xhr.onload = function onLoad() {
41-
if (this.status >= 200 && this.status < 300) {
41+
// 3xx is a valid response for us, since the server was reachable
42+
if (this.status >= 200 && this.status < 400) {
4243
clearTimeout(tOut);
4344
resolve(xhr.response);
4445
} else {

src/withNetworkConnectivity.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ type State = {
3131
const withNetworkConnectivity = ({
3232
withRedux = false,
3333
timeout = 3000,
34-
pingServerUrl = 'http://www.google.com/',
34+
pingServerUrl = 'https://www.google.com/',
3535
withExtraHeadRequest = true,
3636
checkConnectionInterval = 0,
3737
checkIntervalOfflineOnly = false,

0 commit comments

Comments
 (0)