Update push message builder

This commit is contained in:
Jake Barnby 2024-12-10 22:53:40 +13:00
parent 15855e2406
commit f2b202aa52
No known key found for this signature in database
GPG key ID: C437A8CC85B96E9C

View file

@ -676,8 +676,8 @@ class Messaging extends Action
private function buildPushMessage(Document $message): Push
{
$to = $message['to'];
$title = ($message['data']['title'] ?? null) === '' ? null : $message['data']['title'];
$body = ($message['data']['body'] ?? null) === '' ? null : $message['data']['body'];
$title = $message['data']['title'] ?? null;
$body = $message['data']['body'] ?? null;
$data = $message['data']['data'] ?? null;
$action = $message['data']['action'] ?? null;
$image = $message['data']['image']['url'] ?? null;
@ -686,11 +686,21 @@ class Messaging extends Action
$color = $message['data']['color'] ?? null;
$tag = $message['data']['tag'] ?? null;
$badge = $message['data']['badge'] ?? null;
$contentAvailable = $message['data']['contentAvailable'] ?? false;
$critical = $message['data']['critical'] ?? false;
$priority = $message['data']['priority'] === 'high'
? Priority::HIGH
: Priority::NORMAL;
$contentAvailable = $message['data']['contentAvailable'] ?? null;
$critical = $message['data']['critical'] ?? null;
$priority = $message['data']['priority'] ?? null;
if ($title === '') {
$title = null;
}
if ($body === '') {
$body = null;
}
if ($priority !== null) {
$priority = $priority === 'high'
? Priority::HIGH
: Priority::NORMAL;
}
return new Push(
$to,