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 #133

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!

darryncampbell commented 2 years ago

I was worried that was going to be a large and risky change but the scope was really limited, I don't see any issues with the code and all my tests pass. Thank you! I will update the package version on npm to 2.1.0

darryncampbell commented 2 years ago

https://www.npmjs.com/package/com-darryncampbell-cordova-plugin-intent/v/2.1.0