Skip to content

Commit

Permalink
Merge pull request #66 from lucadegasperi/patch-1
Browse files Browse the repository at this point in the history
New Header to support iOS 13
  • Loading branch information
edamov authored Aug 7, 2019
2 parents de4578d + e5ed2e9 commit 34b7277
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ class Request
const HEADER_APNS_PRIORITY = 'apns-priority';
const HEADER_APNS_TOPIC = 'apns-topic';
const HEADER_APNS_COLLAPSE_ID = 'apns-collapse-id';
const HEADER_APNS_PUSH_TYPE = 'apns-push-type';

/**
* Request headers.
Expand Down Expand Up @@ -227,10 +228,20 @@ private function prepareApnsHeaders(Notification $notification)

if (is_int($notification->getPriority())) {
$this->headers[self::HEADER_APNS_PRIORITY] = $notification->getPriority();
} else if ($notification->getPayload()->isContentAvailable()) {
$this->headers[self::HEADER_APNS_PRIORITY] = Notification::PRIORITY_LOW;
}

if (!empty($notification->getCollapseId())) {
$this->headers[self::HEADER_APNS_COLLAPSE_ID ] = $notification->getCollapseId();
}

// new header required to support iOS 13

$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'alert';

if ($notification->getPayload()->isContentAvailable()) {
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'background';
}
}
}

0 comments on commit 34b7277

Please sign in to comment.