react-native-location-enabler icon indicating copy to clipboard operation
react-native-location-enabler copied to clipboard

ActivityEventListener listens to all requestCode

Open nikonhub opened this issue 3 years ago • 0 comments

Hello,

I've got an issue when listening to LocationEnabler. locationEnabled is emitted as false each time I return from library selection activity for example.

This line prevents the listener to return early resulting in an incorrect interpretation of arguments.

For example if I've opened the library with a random request code 12345. Here the Intent is null. So the code continues.

if (intent !== null && requestCode != REQUEST_TURN_DEVICE_LOCATION_ON) return

I'd just remove the "intent !== null" part. Because I don't see any reason to continue if the request code is not 29. But maybe I'm missing an important detail here for why this is done with "intent !== null" ?

nikonhub avatar Feb 15 '23 15:02 nikonhub