django-push-notifications icon indicating copy to clipboard operation
django-push-notifications copied to clipboard

apns_async does not support passing badge as a function

Open ShwnYx opened this issue 8 months ago • 2 comments

After a python upgrade to 3.10+, I migrated from using the apns module to using the apns_async module. I then discovered that the apns_async module does not support passing badge as a function which was a feature in the apns module.

ShwnYx avatar Apr 01 '25 20:04 ShwnYx

hi @ShwnYx, perhaps, in legacy APIs yes, however, newer APIs of APNs advocated for number as keys to modify the badge icon of the app icon.

badge Number Include this key when you want the system to modify the badge of your app icon. If this key is not included in the dictionary, the badge is not changed. To remove the badge, set the value of this key to 0.

As seen from the documentation, which is why the badge key is a number.

50-Course avatar Apr 27 '25 08:04 50-Course

documentation

hi @50-Course

I see I see, just to further clarify, what I meant is in apns.py, specifically here https://github.com/jazzband/django-push-notifications/blob/16d43c2f3b7593f288132731cc98cd3061bea54d/push_notifications/apns.py#L52. I can pass in the badge as a function so it can fetch a customize the badge number for each device, since the notifications are sent i bulk. For example user1 has 3 unread notifications and user2 has 4 unread notifications prior to sending the current notification, they should each receive 4 and 5 as their badge.

the new apns_async.py no longer support that so when sending notifications in bulk I can no longer customize the badge for each device. Let me know if that makes my question clearer, thanks!

ShwnYx avatar Apr 30 '25 17:04 ShwnYx