capacitor-community / fcm

Enable Firebase Cloud Messaging for Capacitor apps
https://capacitor.ionicframework.com/docs/
MIT License
243 stars 83 forks source link

Add setAutoInitEnabled and isAutoInitEnabled methods to control the auto initialization of the library #57

Closed msimkunas closed 3 years ago

msimkunas commented 3 years ago

Fixes #52.

This PR implements auto initialization control in accordance with the Firebase docs[1][2].

Should I publish a separate PR for updating the README.md of this plugin?

[1] https://firebase.google.com/docs/cloud-messaging/android/client#prevent-auto-init [2] https://firebase.google.com/docs/cloud-messaging/ios/client#prevent_auto_initialization

msimkunas commented 3 years ago

Thanks, will do.

msimkunas commented 3 years ago

Done.

msimkunas commented 3 years ago

Any update on if and when this can be merged?

msimkunas commented 3 years ago

Bump

stewones commented 3 years ago

@msimkunas sorry for the delay. I reviewed your code today and would like to request a little change

can you rename the api from setAutoInitEnabled to just setAutoInit ? it reads better since enabled is already a property you pass in the options.

msimkunas commented 3 years ago

The reason I chose setAutoInitEnabled is to ensure consistency with the Firebase API (see the links above).

If you still prefer setAutoInit, I can update the PR soon.

msimkunas commented 3 years ago

The API of this plugin is different though because the setAutoInitEnabled method accepts an options object instead of a boolean value so I guess a shorter version of the original method name is preferred.

stewones commented 3 years ago

I understand. Yeah Capacitor only accepts object as options, also the whole plugin api is built shorter already. That’s why I prefer to keep consistency here instead firebase.