Skip to content

Commit

Permalink
Merge branch 'webocoders-master'
Browse files Browse the repository at this point in the history
  • Loading branch information
dwightwatson committed Mar 1, 2024
2 parents 7db94af + b343131 commit c6fe26e
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/ApnAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
}
15 changes: 15 additions & 0 deletions src/ApnMessage.php
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,11 @@ class ApnMessage
*/
public ?string $apnsId = null;

/**
* The message priority.
*/
public ?ApnMessagePriority $priority = null;

/**
* Message specific client.
*/
Expand Down Expand Up @@ -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.
*/
Expand Down
9 changes: 9 additions & 0 deletions src/ApnMessagePriority.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace NotificationChannels\Apn;

enum ApnMessagePriority
{
case Low;
case High;
}

0 comments on commit c6fe26e

Please sign in to comment.