ostinelli / apnotic

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

Add apns-push-type header #85

Closed noefroidevaux closed 5 years ago

noefroidevaux commented 5 years ago

Hello!

With iOS 13 we should send a apns-push-type header which is set to background if it's a silent/background push notification or alert if it's display something.

I made this pull request to set the apns-push-type header if the aps payload contains only the content-available and is equal to 1 (as described in source [2]).

Sources: [1] https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/sending_notification_requests_to_apns#2947610 [2] https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/pushing_background_updates_to_your_app

noefroidevaux commented 5 years ago

@ostinelli Do you need more info? As iOS 13 arrives in few weeks, please tell me if you need something more to accept this pull request.

dylanbromby commented 5 years ago

+1. This is critical for anyone using this gem to send iOS notifications.

ostinelli commented 5 years ago

Thank you, sorry for late response. I am AFK. Will be back tomorrow, review and hopefully and release. Has someone already tested this patch in prod?

ostinelli commented 5 years ago

Merged and released 1.6.0. Thank you.

noefroidevaux commented 5 years ago

Thank you, sorry for late response. I am AFK. Will be back tomorrow, review and hopefully and release. Has someone already tested this patch in prod?

I use it in production, but only with background notifications.

Thank you!

mrz1277 commented 5 years ago

What if the push type is VoIP? Normally it doesn't have content-available key on the payload. I can't find if the VoIP push also needs this header or not.