Skip to content

Commit

Permalink
Add support for voip notifications
Browse files Browse the repository at this point in the history
A little bit hackery, this might be a WIP that needs to be improved
  • Loading branch information
angvp-sng committed Nov 17, 2019
1 parent a84a754 commit aab34b3
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -235,13 +235,19 @@ private function prepareApnsHeaders(Notification $notification)
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';

$payload = $notification->getPayload();
try {
$apnsTopic = $payload->getCustomValue(self::HEADER_APNS_TOPIC);
} catch (InvalidPayloadException $e) {
}
if ($notification->getPayload()->isContentAvailable()) {
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'background';
}
if (isset($apnsTopic) && !empty($apnsTopic)) {
$this->headers[self::HEADER_APNS_TOPIC] = $apnsTopic;
$this->headers[self::HEADER_APNS_PUSH_TYPE] = 'voip';
}
}
}

0 comments on commit aab34b3

Please sign in to comment.