From fc6f0306f87368980bd04b657b3878d7ee202210 Mon Sep 17 00:00:00 2001 From: Charles Cheung <56040486+chklch-pd@users.noreply.github.com> Date: Fri, 24 Nov 2023 15:36:59 -0500 Subject: [PATCH] fix: add ExpiredToken as option for error response (#240) see https://developer.apple.com/documentation/usernotifications/setting_up_a_remote_notification_server/handling_notification_responses_from_apns --- docs/APNS Apple iOS.md | 1 + lib/pigeon/apns/error.ex | 2 ++ lib/pigeon/apns/notification.ex | 1 + 3 files changed, 4 insertions(+) diff --git a/docs/APNS Apple iOS.md b/docs/APNS Apple iOS.md index 076e7bce..3cc731bc 100644 --- a/docs/APNS Apple iOS.md +++ b/docs/APNS Apple iOS.md @@ -228,6 +228,7 @@ _Taken from [APNS Provider API](https://developer.apple.com/library/content/docu | `:missing_provider_token` | No provider certificate was used to connect to APNs and Authorization header was missing or no provider token was specified. | | `:bad_path` | The request contained a bad :path value. | | `:method_not_allowed` | The specified :method was not POST. | +| `:expired_token` | The device token has expired. | | `:unregistered` | The device token is inactive for the specified topic. | | `:payload_too_large` | The message payload was too large. The maximum payload size is 4096 bytes. | | `:too_many_provider_token_updates` | The provider token is being updated too often. | diff --git a/lib/pigeon/apns/error.ex b/lib/pigeon/apns/error.ex index 956cee74..f1dfe2bb 100644 --- a/lib/pigeon/apns/error.ex +++ b/lib/pigeon/apns/error.ex @@ -59,6 +59,8 @@ defmodule Pigeon.APNS.Error do defp parse_response("MethodNotAllowed"), do: :method_not_allowed + defp parse_response("ExpiredToken"), do: :expired_token + defp parse_response("Unregistered"), do: :unregistered defp parse_response("PayloadTooLarge"), do: :payload_too_large diff --git a/lib/pigeon/apns/notification.ex b/lib/pigeon/apns/notification.ex index d44d9306..4a067ac1 100644 --- a/lib/pigeon/apns/notification.ex +++ b/lib/pigeon/apns/notification.ex @@ -79,6 +79,7 @@ defmodule Pigeon.APNS.Notification do | :missing_provider_token | :bad_path | :method_not_allowed + | :expired_token | :unregistered | :payload_too_large | :too_many_provider_token_updates