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