Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
_ensureIsConnectionExpensiveIsUpToDate = () =>
Platform.OS === 'android' &&
NetInfo.isConnectionExpensive()
.then(isConnectionExpensive => this.setState({ isConnectionExpensive }))
.catch(console.warn)
_checkIfExpensive = () => {
NetInfo.isConnectionExpensive().then(isConnectionExpensive => {
this.setState({isConnectionExpensive});
});
};
static async isConnectionWifi(): Promise {
const connectionInfo = await NetInfo.getConnectionInfo()
const isConnectionExpensive = await NetInfo.isConnectionExpensive()
Logger.debug(TAG, `isConnectionWifi/Connection type is ${connectionInfo.type}`)
Logger.debug(TAG, `isConnectionWifi/is connection expensive: ${isConnectionExpensive}`)
return connectionInfo.type.toString().toLowerCase() === 'wifi' && !isConnectionExpensive
}
}