Skip to content
This repository has been archived by the owner on Sep 5, 2024. It is now read-only.

add support for images #185

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Message/PayloadNotification.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,12 @@ class PayloadNotification implements Arrayable
*/
protected $tag;

/**
* @internal
*
* @var null|string
*/
protected $image;
/**
* @internal
*
Expand Down Expand Up @@ -114,6 +120,7 @@ public function __construct(PayloadNotificationBuilder $builder)
$this->sound = $builder->getSound();
$this->badge = $builder->getBadge();
$this->tag = $builder->getTag();
$this->image = $builder->getImage();
$this->color = $builder->getColor();
$this->clickAction = $builder->getClickAction();
$this->bodyLocationKey = $builder->getBodyLocationKey();
Expand All @@ -137,6 +144,7 @@ public function toArray()
'sound' => $this->sound,
'badge' => $this->badge,
'tag' => $this->tag,
'image' => $this->image,
'color' => $this->color,
'click_action' => $this->clickAction,
'body_loc_key' => $this->bodyLocationKey,
Expand Down
26 changes: 26 additions & 0 deletions src/Message/PayloadNotificationBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,22 @@ public function setTag($tag)
return $this;
}


/**
* Indicates the image that can be displayed in the notification
* Supports an url or internal image.
*
* @param string $image
*
* @return PayloadNotificationBuilder current instance of the builder
*/
public function setImage($image)
{
$this->image = $image;

return $this;
}

/**
* Supported Android.
*
Expand Down Expand Up @@ -375,6 +391,16 @@ public function getTag()
return $this->tag;
}

/**
* Get image.
*
* @return null|string
*/
public function getImage()
{
return $this->image;
}

/**
* Get Color.
*
Expand Down