From 9b6dbc2d7fef54dfca0c2487a9a558211539da8f Mon Sep 17 00:00:00 2001 From: remyweinstein Date: Fri, 23 Jun 2023 18:53:08 +1000 Subject: [PATCH 1/3] add image url --- src/Notification.php | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Notification.php b/src/Notification.php index ad18565..28c171c 100644 --- a/src/Notification.php +++ b/src/Notification.php @@ -14,6 +14,7 @@ class Notification extends Message private $clickAction; private $tag; private $content_available; + private $image; public function __construct($title = '', $body = '') { @@ -84,6 +85,12 @@ public function setContentAvailable($content_available) return $this; } + public function setImage($image) + { + $this->image = $image; + return $this; + } + public function jsonSerialize() { $jsonData = $this->getJsonData(); @@ -111,6 +118,9 @@ public function jsonSerialize() if ($this->content_available) { $jsonData['content_available'] = $this->content_available; } + if ($this->image) { + $jsonData['image'] = $this->image; + } return $jsonData; } } From 7dd556018db97a2eb277fbd135561160821965f2 Mon Sep 17 00:00:00 2001 From: grebenyuk_dv Date: Tue, 26 Mar 2024 10:30:52 +1000 Subject: [PATCH 2/3] change data to array --- src/Message.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Message.php b/src/Message.php index 996419e..9b71eaf 100644 --- a/src/Message.php +++ b/src/Message.php @@ -19,7 +19,7 @@ class Message implements \JsonSerializable private $notification; private $collapseKey; private $priority; - private $data; + private $data = []; private $recipients = []; private $recipientType; private $jsonData; @@ -71,7 +71,7 @@ public function setPriority($priority) public function setData(array $data) { - $this->data = $data; + $this->data[] = $data; return $this; } From 9804b556beafa368034e671fe592c10a5a30e4de Mon Sep 17 00:00:00 2001 From: grebenyuk_dv Date: Tue, 26 Mar 2024 11:31:05 +1000 Subject: [PATCH 3/3] fix data array --- src/Message.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Message.php b/src/Message.php index 9b71eaf..0efa365 100644 --- a/src/Message.php +++ b/src/Message.php @@ -71,7 +71,7 @@ public function setPriority($priority) public function setData(array $data) { - $this->data[] = $data; + $this->data = array_merge($this->data, $data); return $this; }