Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update Notification.php #30

Closed
wants to merge 1 commit into from
Closed
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
23 changes: 22 additions & 1 deletion src/Push/Notification.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,18 @@ class Notification implements Request
*/
private $badge;


/**
* @var string
*/
private $android_channel_id;

/**
* @param string $title
* @param string $body
* @param string $recipient
*/
public function __construct(string $title = '', string $body = '', string $recipient = '', string $sound = '', string $icon = '', string $color = '', int $badge = 0, string $tag = '', string $subtitle = '', array $data = [])
public function __construct(string $title = '', string $body = '', string $recipient = '', string $sound = '', string $icon = '', string $color = '', int $badge = 0, string $tag = '', string $subtitle = '', array $data = [] , string $android_channel_id = "")
{
$this->title = $title;
$this->body = $body;
Expand All @@ -64,6 +70,7 @@ public function __construct(string $title = '', string $body = '', string $recip
$this->badge = $badge;
$this->tag = $tag;
$this->subtitle = $subtitle;
$this->android_channel_id = $android_channel_id;

if (!empty($data)) {
$this->data = $data;
Expand Down Expand Up @@ -170,6 +177,18 @@ public function setSubtitle(string $subtitle): self
return $this;
}

/**
* @param string $android_channel_id
*
* @return $this
*/
public function setAndroidChannelID(string $android_channel_id): self
{
$this->android_channel_id = $android_channel_id;

return $this;
}

/**
* @inheritdoc
*/
Expand Down Expand Up @@ -219,6 +238,8 @@ public function getBody(): array
if ($this->badge>0) {
$request['notification']['badge'] = $this->badge;
}
if($this->android_channel_id != "")
$request['notification']['android_channel_id'] = $this->android_channel_id;

if (!empty($this->data)) {
$request['data'] = $this->data;
Expand Down