Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
private static _getNetworkTypeFromConnectionInfo(state: RNNetInfo.NetInfoState): Types.DeviceNetworkType {
if (state.type === RNNetInfo.NetInfoStateType.cellular) {
if (state.details === null || state.details.cellularGeneration === null) {
return Types.DeviceNetworkType.Unknown;
} else if (state.details.cellularGeneration === '2g') {
return Types.DeviceNetworkType.Mobile2G;
} else if (state.details.cellularGeneration === '3g') {
return Types.DeviceNetworkType.Mobile3G;
} else if (state.details.cellularGeneration === '4g') {
return Types.DeviceNetworkType.Mobile4G;
}
} else if (state.type === RNNetInfo.NetInfoStateType.wifi ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.ethernet ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.wimax ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.none) {
private static _getNetworkTypeFromConnectionInfo(state: RNNetInfo.NetInfoState): Types.DeviceNetworkType {
if (state.type === RNNetInfo.NetInfoStateType.cellular) {
if (state.details === null || state.details.cellularGeneration === null) {
return Types.DeviceNetworkType.Unknown;
} else if (state.details.cellularGeneration === '2g') {
return Types.DeviceNetworkType.Mobile2G;
} else if (state.details.cellularGeneration === '3g') {
return Types.DeviceNetworkType.Mobile3G;
} else if (state.details.cellularGeneration === '4g') {
return Types.DeviceNetworkType.Mobile4G;
}
} else if (state.type === RNNetInfo.NetInfoStateType.wifi ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.ethernet ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.wimax ) {
return Types.DeviceNetworkType.Wifi;
} else if (state.type === RNNetInfo.NetInfoStateType.none) {
return Types.DeviceNetworkType.None;
}
return Types.DeviceNetworkType.Unknown;
}
}