aboozaid / react-native-tethering

A React Native module for working with Wi-Fi and Hotspot. Compatible with Expo.
https://react-native-tethering.onrender.com/
MIT License
17 stars 2 forks source link

disconnectFromLocalNetwork: reject the promise there is an unhandled exception #21

Open SamakaCD opened 1 year ago

SamakaCD commented 1 year ago

It's pretty easy to get "NetworkCallback was not registered" error when disconnecting from a local network which is unhandled one. The PR handles it and rejects returned promise if it has been thrown.

aboozaid commented 1 year ago

Thank you for this pull request. I think the disconnect func will always has an error when there's NetworkCallback registered so it's better to just resolve it silently in catch instead of throwing an error. What do you think?

SamakaCD commented 1 year ago

Need to investigate why it throws the error. I guess, that's because unregisterNetworkCallback is called once the app connects. Why do we do so instead of bindProcessToNetwork? I understand that there's a good reason for that since bindProcessToNetwork was used previously.

aboozaid commented 1 year ago

Need to investigate why it throws the error. I guess, that's because unregisterNetworkCallback is called once the app connects. Why do we do so instead of bindProcessToNetwork? I understand that there's a good reason for that since bindProcessToNetwork was used previously.

Sorry I meant when you don't have a NetworkCallback registered it will always throws an error