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