How to use the react-native-permissions.RESULTS.LIMITED function in react-native-permissions

To help you get started, we’ve selected a few react-native-permissions examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github berty / berty / js / packages / components / settings / Bluetooth.tsx View on Github external
const checkBluetoothPermission = async (): Promise => {
	let permission =
		Platform.OS === 'ios'
			? PERMISSIONS.IOS.BLUETOOTH_PERIPHERAL
			: PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION
	try {
		let result = await check(permission)
		switch (result) {
			case RESULTS.UNAVAILABLE:
				console.log('Bluetooth is not available (on this device / in this context)')
				break
			case RESULTS.DENIED:
				console.log('The Bluetooth permission has not been requested / is denied but requestable')
				break
			case RESULTS.LIMITED:
				console.log('The Bluetooth permission is limited: some actions are possible')
				break
			case RESULTS.GRANTED:
				console.log('The Bluetooth permission is granted')
				return true
			case RESULTS.BLOCKED:
				console.log('The Bluetooth permission is denied and not requestable anymore')
				break
		}
	} catch (error) {
		console.log('The Bluetooth permission check failed: ', error)
	}
	return false
}