1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 | export declare enum NetInfoStateType {
|
10 | unknown = "unknown",
|
11 | none = "none",
|
12 | cellular = "cellular",
|
13 | wifi = "wifi",
|
14 | bluetooth = "bluetooth",
|
15 | ethernet = "ethernet",
|
16 | wimax = "wimax",
|
17 | vpn = "vpn",
|
18 | other = "other"
|
19 | }
|
20 | export declare enum NetInfoCellularGeneration {
|
21 | '2g' = "2g",
|
22 | '3g' = "3g",
|
23 | '4g' = "4g"
|
24 | }
|
25 | export interface NetInfoConnectedDetails {
|
26 | isConnectionExpensive: boolean;
|
27 | }
|
28 | interface NetInfoConnectedState<T extends NetInfoStateType, D extends object = {}> {
|
29 | type: T;
|
30 | isConnected: true;
|
31 | isInternetReachable: boolean | null;
|
32 | details: D & NetInfoConnectedDetails;
|
33 | isWifiEnabled?: boolean;
|
34 | }
|
35 | interface NetInfoDisconnectedState<T extends NetInfoStateType> {
|
36 | type: T;
|
37 | isConnected: false;
|
38 | isInternetReachable: false;
|
39 | details: null;
|
40 | }
|
41 | export interface NetInfoUnknownState {
|
42 | type: NetInfoStateType.unknown;
|
43 | isConnected: null;
|
44 | isInternetReachable: null;
|
45 | details: null;
|
46 | }
|
47 | export declare type NetInfoNoConnectionState = NetInfoDisconnectedState<NetInfoStateType.none>;
|
48 | export declare type NetInfoDisconnectedStates = NetInfoUnknownState | NetInfoNoConnectionState;
|
49 | export declare type NetInfoCellularState = NetInfoConnectedState<NetInfoStateType.cellular, {
|
50 | cellularGeneration: NetInfoCellularGeneration | null;
|
51 | carrier: string | null;
|
52 | }>;
|
53 | export declare type NetInfoWifiState = NetInfoConnectedState<NetInfoStateType.wifi, {
|
54 | ssid: string | null;
|
55 | bssid: string | null;
|
56 | strength: number | null;
|
57 | ipAddress: string | null;
|
58 | subnet: string | null;
|
59 | frequency: number | null;
|
60 | }>;
|
61 | export declare type NetInfoBluetoothState = NetInfoConnectedState<NetInfoStateType.bluetooth>;
|
62 | export declare type NetInfoEthernetState = NetInfoConnectedState<NetInfoStateType.ethernet, {
|
63 | ipAddress: string | null;
|
64 | subnet: string | null;
|
65 | }>;
|
66 | export declare type NetInfoWimaxState = NetInfoConnectedState<NetInfoStateType.wimax>;
|
67 | export declare type NetInfoVpnState = NetInfoConnectedState<NetInfoStateType.vpn>;
|
68 | export declare type NetInfoOtherState = NetInfoConnectedState<NetInfoStateType.other>;
|
69 | export declare type NetInfoConnectedStates = NetInfoCellularState | NetInfoWifiState | NetInfoBluetoothState | NetInfoEthernetState | NetInfoWimaxState | NetInfoVpnState | NetInfoOtherState;
|
70 | export declare type NetInfoState = NetInfoDisconnectedStates | NetInfoConnectedStates;
|
71 | export declare type NetInfoChangeHandler = (state: NetInfoState) => void;
|
72 | export declare type NetInfoSubscription = () => void;
|
73 | export interface NetInfoConfiguration {
|
74 | reachabilityUrl: string;
|
75 | reachabilityTest: (response: Response) => Promise<boolean>;
|
76 | reachabilityLongTimeout: number;
|
77 | reachabilityShortTimeout: number;
|
78 | reachabilityRequestTimeout: number;
|
79 | }
|
80 | export {};
|