diff --git a/src/ApnAdapter.php b/src/ApnAdapter.php index 83e17e8..c7a5e3f 100644 --- a/src/ApnAdapter.php +++ b/src/ApnAdapter.php @@ -107,6 +107,14 @@ public function adapt(ApnMessage $message, string $token): Notification $notification->setId($apnsId); } + if ($message->priority === ApnMessagePriority::Low) { + $notification->setLowPriority(); + } + + if ($message->priority === ApnMessagePriority::High) { + $notification->setHighPriority(); + } + return $notification; } } diff --git a/src/ApnMessage.php b/src/ApnMessage.php index 2f10f1b..a90fdc0 100644 --- a/src/ApnMessage.php +++ b/src/ApnMessage.php @@ -115,6 +115,11 @@ class ApnMessage */ public ?string $apnsId = null; + /** + * The message priority. + */ + public ?ApnMessagePriority $priority = null; + /** * Message specific client. */ @@ -281,6 +286,16 @@ public function apnsId(?string $apnsId): self return $this; } + /** + * Set the message priority. + */ + public function priority(ApnMessagePriority $priority): self + { + $this->priority = $priority; + + return $this; + } + /** * Set a title-loc-key. */ diff --git a/src/ApnMessagePriority.php b/src/ApnMessagePriority.php new file mode 100644 index 0000000..30a57b3 --- /dev/null +++ b/src/ApnMessagePriority.php @@ -0,0 +1,9 @@ +