codedge-llc / pigeon

iOS and Android push notifications for Elixir
https://hex.pm/packages/pigeon
MIT License
631 stars 142 forks source link

Sending iOS 13 apns-push-type header through FCM system #159

Open macciomauro opened 4 years ago

macciomauro commented 4 years ago

Hi, I'm using Pigeon to send custom data notifications both to Android and iOS devices through Firebase and everything works fine.

Here's an example:

registration_ids
    |> Pigeon.FCM.Notification.new(nil)
    |> Pigeon.FCM.Notification.put_data(%{title: "The title", body: "The body"})
    |> Pigeon.FCM.Notification.put_priority(:normal)
    |> Pigeon.FCM.Notification.put_content_available(true)
    |> Pigeon.FCM.push()

As you know in iOS 13 Apple recommends the usage of a apns-push-type for notifications check and I saw you merged a feature to set this header in APNs system.

My questions are: Is Firebase automatically setting apns-push-type header when Pigeon call it? If yes, with what value between alert and background? There maybe should be a specific function to set it like put_priority or put_content_available? Is there an alternative method to set it (custom headers)?

I found this Stackoverflow question that talk about ApnsConfig in Admin SDK but I don't think can be useful.

Thank you in advance

halostatue commented 3 years ago

This may be helped by upgrading to HTTP v1 API for FCM (#169), which is on the roadmap for v2. There are specific options to put for different platforms in the same notification structure.