yuki24 / andpush

Android Push Notification in Ruby: The fastest client for FCM (Firebase Cloud Messaging)
https://github.com/yuki24/andpush
MIT License
82 stars 10 forks source link

iOS13 Support. #10

Open yukitoto opened 5 years ago

yukitoto commented 5 years ago

We need to set apns-priority and apns-push-type for header from iOS13. Is there any option to set these properties?

https://developer.apple.com/videos/play/wwdc2019/707/?time=800

yukitoto commented 5 years ago

Is it correct solution?

client = AndPush.build(server_key)
client.push(payload, headers: { 'apns-priority': 10, 'apns-push-type': 'alert' })
yuki24 commented 5 years ago

FCM wraps the APN and thus we have to follow FCM's specification. You could find how to specify apns-priority here (find the doc for the priority key).

On iOS, these correspond to APNs priorities 5 and 10.

With the andpush gem that calls the legacy FCM API, this is already possible:

payload = {
  ...
  priority: 5 # or 10 depending on your operation
}

response = client.push(payload)