darryncampbell / darryncampbell-cordova-plugin-intent

General purpose intent shim layer for cordova appliations on Android. Handles various techniques for sending and receiving intents.
MIT License
86 stars 130 forks source link

Support registering multiple BroadcastReciever elements #132

Closed mattdsteele closed 2 years ago

mattdsteele commented 2 years ago

Fixes #131

This PR adds support for calling registerBroadcastReceiver multiple times, while retaining previous registrations. Callbacks are associated with a new HashMap, which also retains all BroadcastReceiver objects.

unregisterBroadcastReceiver now unregisters all receivers; to support backwards compatibility.

I tried to minimize the scope of this change, so other methods like onIntent and onActivityResult continue to only support one registration. This meets all of my use cases, but if you'd prefer to update the other methods for consistency, let me know. Thanks!

mattdsteele commented 2 years ago

Apologies for the ugly commits and force-pushes; I'll close this and create a new PR