Skip to content

Commit c5e7cd2

Browse files
authored
Make channelId property optional
1 parent 2579fea commit c5e7cd2

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

src/ExpoMessage.php

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ class ExpoMessage
4747
*
4848
* @var string
4949
*/
50-
protected $channelId = 'Default';
50+
protected $channelId = '';
5151

5252
/**
5353
* The json data attached to the message.
@@ -205,14 +205,17 @@ public function setJsonData($data)
205205
*/
206206
public function toArray()
207207
{
208-
return [
208+
$message = [
209209
'title' => $this->title,
210210
'body' => $this->body,
211211
'sound' => $this->sound,
212212
'badge' => $this->badge,
213213
'ttl' => $this->ttl,
214-
'channelId' => $this->channelId,
215-
'data' => $this->jsonData,
214+
'data' => $this->jsonData
216215
];
216+
if (!empty($this->channelId)) {
217+
$message['channelId'] = $this->channelId;
218+
}
219+
return $message;
217220
}
218221
}

0 commit comments

Comments
 (0)