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