Skip to content

Commit 3ae5fd8

Browse files
authored
Merge pull request sngrl#14 from nandorh/poll-request-contentavailable-chage
Poll request contentavailable chage
2 parents c67b6c2 + 2d89918 commit 3ae5fd8

File tree

2 files changed

+18
-2
lines changed

2 files changed

+18
-2
lines changed

src/Notification.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Notification extends Message
1313
private $sound;
1414
private $clickAction;
1515
private $tag;
16+
private $content_available;
1617

1718
public function __construct($title = '', $body = '')
1819
{
@@ -77,6 +78,12 @@ public function setTag($tag)
7778
return $this;
7879
}
7980

81+
public function setContentAvailable($content_available)
82+
{
83+
$this->content_available = $content_available;
84+
return $this;
85+
}
86+
8087
public function jsonSerialize()
8188
{
8289
$jsonData = $this->getJsonData();
@@ -101,6 +108,9 @@ public function jsonSerialize()
101108
if ($this->tag) {
102109
$jsonData['tag'] = $this->tag;
103110
}
111+
if ($this->content_available) {
112+
$jsonData['content_available'] = $this->content_available;
113+
}
104114
return $jsonData;
105115
}
106-
}
116+
}

tests/NotificationTest.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,4 +29,10 @@ public function testJsonSerializeWithIcon()
2929
$this->fixture->setIcon('name');
3030
$this->assertEquals(array('title' => 'foo', 'body' =>'bar', 'icon' => 'name'), $this->fixture->jsonSerialize());
3131
}
32-
}
32+
33+
public function testJsonSerializeWithContentAvailable()
34+
{
35+
$this->fixture->setContentAvailable(true);
36+
$this->assertEquals(array('title' => 'foo', 'body' =>'bar', 'content_available' => true), $this->fixture->jsonSerialize());
37+
}
38+
}

0 commit comments

Comments
 (0)