jazzband / django-push-notifications

Send push notifications to mobile devices through GCM or APNS in Django.
MIT License
2.28k stars 618 forks source link

FCM send_message return type is not compatible with previous output #722

Open sevdog opened 6 months ago

sevdog commented 6 months ago

The implementation with firebase SDK has changed the output of the send_message method

Before it was a dict

https://github.com/jazzband/django-push-notifications/blob/7d2805266dfe3384823ae97f2d674d31d0a97a2d/push_notifications/gcm.py#L202-L204

Now it is a BatchResponse

https://github.com/jazzband/django-push-notifications/blob/0f7918136b5e6a9aec83d6513aad5b0f12143a9f/push_notifications/gcm.py#L188-L190

This means that any code which relies on the output to be a dict now need to work-around the new type.

This is a breaking change which should have been highlighted or avoided.

sevdog commented 6 months ago

My point is that previously it was possible to handle the output of different Device (ie: WebpushDevice and GCMDevice) with the same code because they were returning dict/list[dict] according if you were calling the method on a single instance or on the queryset.

Now the code should be reworked to hande the BatchResponse from firebase SDK.

My question is: is this project willing to keep a common API for .send_message output or is it letting any device kind to provide a different output for such method?