Ph3nol / NotificationPusher

Standalone PHP library for easy devices notifications push.
MIT License
1.18k stars 273 forks source link

APNS Allow to remove badge field (that field is not required for APNS) #83

Open adrianmalik opened 9 years ago

adrianmalik commented 9 years ago

Please allow developers to remove badge field. For example class ZendService\Apple\Apns\Message accepts badge to be null (then badge is not sent) but you force badge field to be an integer.

Class: Sly\NotificationPusher\Adapter\Apns Lines: 163- 166 Content of that lines: $badge = ($message->hasOption('badge')) ? (int) ($message->getOption('badge') + $device->getParameter('badge', 0)) : 0 ;

Sample solution:

SoldierCorp commented 9 years ago

+1 I'm facing the same issue, could you please remove that badge parameter by default and send only when is set by the user.

juliangut commented 8 years ago

https://github.com/Ph3nol/NotificationPusher/blob/master/src/Sly/NotificationPusher/Adapter/Apns.php#L208

You can see only if badge is other than 0 it is set in \ZendService\Apple\Apns\Message. The same is true for sound, content-available and category but in this cases the comparison is with null

alalonde commented 8 years ago

My PR sets the default badge to be null.

seyfer commented 7 years ago

@alalonde , do you mean this PR #89? I don't see here changes connected with the badge, only with sound field.

So, the issue is still present?

alalonde commented 7 years ago

Hmm, it's been awhile since I created that, but I might have reverted that part of the PR, so as not to fix multiple things at once.