X-Guard / react-native-flic2

Use Flic 2 within your React Native application with ease.
Other
8 stars 9 forks source link

check if bluetooth is enabled to show foreground notification #31

Open LucasMonteiro1 opened 2 years ago

LucasMonteiro1 commented 2 years ago

When you start the application it is creating the notification even with bluetooth disabled. This PR fixes that detail.

LucasMonteiro1 commented 2 years ago

Hi @wesdewitte and @jdegger, now I think the changes are done.

Basically this change is to not show the notification in the foreground when bluetooth is disabled. I tried to do this in React Native code but it didn't work.

jdegger commented 2 years ago

Hi @LucasMonteiro1, once again thanks for your PR!

This might be true, we are in a app context ourselves where this is not really a problem.

However, wouldn't a more react-native focused solution be better? At the moment we have a function called Flic2.startService();. It would make sense for us to also implement Flic2.stopService().

If that function is integrated, we could just listen for the bluetooth state in the javascript context right?

LucasMonteiro1 commented 2 years ago

Thanks for answering @jdegger!!

I haven't found a possible way to remove the notification through JS code as the startService method is called in startup and the notification seems to be displaying even before calling these two methods.

When I don't have buttons linked to the app, it no longer shows the notification, this is correct, it only happens when I already have a button linked and I reopen the app or turn off bluetooth during use.

If you think we have a better way to resolve this behavior, can you help me?

jdegger commented 2 years ago

@LucasMonteiro1 quick update: we are now in the final stages of a development phase for our own app. When we finish this sprint and enter the new one, we can dedicate some time to checking your PRs. Thanks for your patience and contribution.