cordova-plugin-app-event icon indicating copy to clipboard operation
cordova-plugin-app-event copied to clipboard

[Feature request] Support more application events

Open dpa99c opened this issue 4 years ago • 3 comments

First of all, great idea in creating this plugin!

It's something that has bothered me for a while with my own plugins when they conflict with other plugins which register delegate methods for the same events.

I intend to make use of this plugin as a dependency for my fork of cordova-plugin-firebase - cordova-plugin-firebasex - as this is something that's already been raised as an issue: https://github.com/dpa99c/cordova-plugin-firebasex/issues/443

However, I'd need to extend you plugin to support the following additional application events:

  • applicationDidBecomeActive
  • applicationDidEnterBackground
  • didRegisterForRemoteNotificationsWithDeviceToken
  • didFailToRegisterForRemoteNotificationsWithError
  • didReceiveRemoteNotification

When I get some time, I'll put up a PR which adds support for these.

There may be some other useful ones on the UIApplicationDelegate class too that are worth adding at the same time.

I think long term it would be great if this plugin could be merged into the core of cordova-ios to provide this broadcast functionality out-of-the-box - it's something I've raised in the Cordova Slack.

dpa99c avatar Jul 02 '20 15:07 dpa99c

OK, as @jcesarmobile rightly pointed out on Cordova Slack, adding delegates for remote notifications events will cause App Store warnings if the provision profile doesn't have push entitlement and can lead to binary rejection, so it's not a good idea to add these to this plugin.

In which case I will create a separate plugin based on this one (e.g. cordova-plugin-app-push-event) which explicitly broadcasts only push-related remote notification events.

However, applicationDidBecomeActive and applicationDidEnterBackground could still safely be added to this plugin.

dpa99c avatar Jul 03 '20 09:07 dpa99c

It doesn't lead to binary rejection, Apple warns just in case you forgot and some people get scared about the warning. But still, not good that all apps that don't use push would get the warning after adding that.

jcesarmobile avatar Jul 06 '20 10:07 jcesarmobile

@jcesarmobile thanks for clarifying - those warnings would probably cause a flood of issues so still worth keeping the push-specific stuff separate.

dpa99c avatar Jul 06 '20 10:07 dpa99c