ostinelli / apnotic

A Ruby APNs HTTP/2 gem able to provide instant feedback.
MIT License
480 stars 96 forks source link

apns-push-type background issue with custom payload #90

Closed danielmorrison closed 3 years ago

danielmorrison commented 4 years ago

Hi, I have an issue where I'm setting content-available to 1 but the notification isn't getting set to 'apns-push-type`background due to having a custom payload.

The code (introduced in #85) checks for aps.count which is the problem here:

https://github.com/ostinelli/apnotic/blob/36a2e36e0b89c5aec627226c83c7955f68f0b3f5/lib/apnotic/notification.rb#L8-L10

I didn't understand why at first, but the test here makes me think this was to ensure we weren't also setting notification.alert.

https://github.com/ostinelli/apnotic/blob/36a2e36e0b89c5aec627226c83c7955f68f0b3f5/spec/apnotic/notification_spec.rb#L173-L180

This seems wrong, as I want to send a background notification with custom data. Is there an intent I'm missing here? Another "gotcha"?

I'm happy to write up a PR with a proposed fix.

benubois commented 3 years ago

This is addressed in #91.