Skip to content

Commit

Permalink
Remove null as instance of netInfoCellularGeneration type
Browse files Browse the repository at this point in the history
  • Loading branch information
sgny committed Jul 8, 2019
1 parent 01f490a commit f91bfd1
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 14 deletions.
19 changes: 12 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,12 +30,11 @@ Kind of the current network connection. Valid values are:

Cellular generation of the current network connection. Valid values are:

| Value | Notes |
| ------- | ----------------------------------------------------------------------------------------------- |
| `null` | Inlined as "null". Returned if the connection is not cellular or its type cannot be determined. |
| `net2g` | Inlined as "2g". Returned for CDMA, EDGE, GPRS and IDEN connections |
| `net3g` | Inlined as "3g". Returned for EHRPD, EVDO, HSPA, HSUPA, HSDPA and UTMS connections. |
| `net4g` | Inlined as "4g". Returned for HSPAP and LTE connections |
| Value | Notes |
| ------- | ----------------------------------------------------------------------------------- |
| `net2g` | Inlined as "2g". Returned for CDMA, EDGE, GPRS and IDEN connections |
| `net3g` | Inlined as "3g". Returned for EHRPD, EVDO, HSPA, HSUPA, HSDPA and UTMS connections. |
| `net4g` | Inlined as "4g". Returned for HSPAP and LTE connections |

### `details`

Expand All @@ -58,7 +57,13 @@ type netInfoState = {
};
```

`details` key will have value `Js.Null.empty` (`null`) when `_type` is `null` or `unknown`. `cellularGeneration` key within the `details` object will have value `Js.Null.empty` when `_type` is `wifi`, `bluetooth`, `ethernet`, `wimax`, `vpn` or `other`. Only when `_type` is `cellular`, `cellularGeneration` will be of type `netInfoCellularGeneration`.
`details` key will have value `Js.Null.empty` (`null`) when `_type` is `null` or `unknown`.

If the `details` objects is not `null`, the `cellularGeneration` key within will

- have value `Js.Nullable.undefined` when `_type` is `wifi`, `bluetooth`, `ethernet`, `wimax`, `vpn` or `other`.
- have value `Js.Nullable.null` if the connection is not cellular or its generation cannot be determined.
- be of type `netInfoCellularGeneration` only when `_type` is `cellular` and its generation can be determined.

## Methods

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "reason-react-native-netinfo",
"version": "3.2.3",
"version": "3.2.4",
"author": "sgny (https://github.com/sgny)",
"repository": "https://github.com/sgny/reason-react-native-netinfo.git",
"license": "MIT",
Expand Down
3 changes: 0 additions & 3 deletions src/CommunityNetInfo.re
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ let net3G = "3g";
[@bs.inline]
let net4G = "4g";

[@bs.inline]
let null = "null";

type details = {
.
"isConnectionExpensive": bool,
Expand Down
3 changes: 0 additions & 3 deletions src/CommunityNetInfo.rei
Original file line number Diff line number Diff line change
Expand Up @@ -40,9 +40,6 @@ let net3G: netInfoCellularGeneration;
[@bs.inline "4g"]
let net4G: netInfoCellularGeneration;

[@bs.inline "null"]
let null: netInfoCellularGeneration;

type details = {
.
"isConnectionExpensive": bool,
Expand Down

0 comments on commit f91bfd1

Please sign in to comment.