Is your feature request related to a problem? Please describe.
On Android, if you don't call await PushNotifications.register(); on JS side, the app would still work fine without push notifications.
However, on iOS, FirebaseApp.configure() always gets called. That crashes the app when GoogleService-Info.plist is missing:
|
override public func load() { |
|
if FirebaseApp.app() == nil { |
|
FirebaseApp.configure() |
|
} |
This is not ideal for making the push notification feature optional for some environments, such as for some of the devs on the team.
Describe the solution you'd like
Offer a configuration or an API change to turn off this behavior.
One option could be using the didRegisterForRemoteNotificationsWithDeviceToken hook Capacitor PushNotifications plugin uses, and let the user add the FirebaseApp.configure() there, if possible.
One would be to simply remove FirebaseApp.configure() as the official Capacitor guide makes the user add that call. So, the user would have control over the call and optionally not call it.
https://capacitorjs.com/docs/guides/push-notifications-firebase#add-initialization-code
... and then add the configuration method for Firebase to initialization code to your AppDelegate.swift file, in the application(didFinishLaunchingWithOptions) method.
FirebaseApp.configure()
Describe alternatives you've considered
On Android, you can get away by not calling PushNotifications.register(). But, I couldn't find a workaround or alternative for iOS.
Additional context

Is your feature request related to a problem? Please describe.
On Android, if you don't call
await PushNotifications.register();on JS side, the app would still work fine without push notifications.However, on iOS,
FirebaseApp.configure()always gets called. That crashes the app whenGoogleService-Info.plistis missing:fcm/ios/Plugin/Plugin.swift
Lines 19 to 22 in fab6ec2
This is not ideal for making the push notification feature optional for some environments, such as for some of the devs on the team.
Describe the solution you'd like
Offer a configuration or an API change to turn off this behavior.
One option could be using the
didRegisterForRemoteNotificationsWithDeviceTokenhook Capacitor PushNotifications plugin uses, and let the user add theFirebaseApp.configure()there, if possible.One would be to simply remove
FirebaseApp.configure()as the official Capacitor guide makes the user add that call. So, the user would have control over the call and optionally not call it.https://capacitorjs.com/docs/guides/push-notifications-firebase#add-initialization-code
Describe alternatives you've considered
On Android, you can get away by not calling
PushNotifications.register(). But, I couldn't find a workaround or alternative for iOS.Additional context