Skip to content

Commit

Permalink
fix: add apns-push-type header for iOS 13 (#155)
Browse files Browse the repository at this point in the history
  • Loading branch information
Phil Toland authored and hpopp committed Oct 13, 2019
1 parent befddba commit 86b611e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/pigeon/apns/notification.ex
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{}},
topic: nil,
Expand All @@ -24,6 +25,7 @@ defmodule Pigeon.APNS.Notification do
device_token: "device token",
expiration: nil,
priority: nil,
push_type: "alert",
id: nil, # Set on push response if nil
payload: %{"aps" => %{"alert" => "push message"}},
response: nil, # Set on push response
Expand All @@ -35,6 +37,7 @@ defmodule Pigeon.APNS.Notification do
device_token: String.t() | nil,
expiration: non_neg_integer | nil,
priority: non_neg_integer | nil,
push_type: String.t() | nil,
id: String.t() | nil,
payload: %{String.t() => String.t()},
response: response,
Expand Down Expand Up @@ -65,6 +68,7 @@ defmodule Pigeon.APNS.Notification do
device_token: "device token",
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"alert" => "push message"}},
topic: nil
Expand Down Expand Up @@ -93,6 +97,7 @@ defmodule Pigeon.APNS.Notification do
device_token: "device token",
expiration: nil,
priority: nil,
push_type: "alert",
id: "id_1234",
payload: %{"aps" => %{"alert" => "push message"}},
topic: "topic"
Expand Down Expand Up @@ -121,6 +126,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"alert" => "push message"}},
topic: nil
Expand All @@ -143,6 +149,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"badge" => 5}},
topic: nil
Expand All @@ -166,6 +173,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"sound" => "custom.aiff"}},
topic: nil
Expand All @@ -189,6 +197,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"content-available" => 1}},
topic: nil
Expand All @@ -209,6 +218,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"category" => "category"}},
topic: nil
Expand All @@ -231,6 +241,7 @@ defmodule Pigeon.APNS.Notification do
device_token: nil,
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"mutable-content" => 1}},
topic: nil
Expand Down Expand Up @@ -262,6 +273,7 @@ defmodule Pigeon.APNS.Notification do
device_token: "device token",
expiration: nil,
priority: nil,
push_type: "alert",
id: nil,
payload: %{"aps" => %{"alert" => "test message"}, "custom-key" => 1234},
topic: nil
Expand Down
2 changes: 2 additions & 0 deletions lib/pigeon/apns/shared.ex
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ defmodule Pigeon.APNS.Shared do
@apns_id "apns-id"
@apns_topic "apns-topic"
@apns_priority "apns-priority"
@apns_push_type "apns-push-type"
@apns_expiration "apns-expiration"
@apns_collapse_id "apns-collapse-id"

Expand All @@ -33,6 +34,7 @@ defmodule Pigeon.APNS.Shared do
|> put_header(@apns_id, notification.id)
|> put_header(@apns_topic, notification.topic)
|> put_header(@apns_priority, notification.priority)
|> put_header(@apns_push_type, notification.push_type)
|> put_header(@apns_expiration, notification.expiration)
|> put_header(@apns_collapse_id, notification.collapse_id)
end
Expand Down

0 comments on commit 86b611e

Please sign in to comment.