mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-05-11 04:52:14 +09:00
Merge pull request #1841 from Waterticket/develop
FCM notification 항목을 추가할 수 있는 메소드 추가 #1836
This commit is contained in:
commit
5bbda4b532
2 changed files with 87 additions and 9 deletions
|
|
@ -59,13 +59,9 @@ class FCM extends Base implements \Rhymix\Framework\Drivers\PushInterface
|
||||||
);
|
);
|
||||||
|
|
||||||
// Set notification
|
// Set notification
|
||||||
$notification = [];
|
$notification = $message->getNotifications() ?? [];
|
||||||
$notification['title'] = $message->getSubject();
|
$notification['title'] = $message->getSubject();
|
||||||
$notification['body'] = $message->getContent();
|
$notification['body'] = $message->getContent();
|
||||||
if($message->getClickAction())
|
|
||||||
{
|
|
||||||
$notification['click_action'] = $message->getClickAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
$chunked_token = array_chunk($tokens, 1000);
|
$chunked_token = array_chunk($tokens, 1000);
|
||||||
foreach($chunked_token as $token_unit)
|
foreach($chunked_token as $token_unit)
|
||||||
|
|
|
||||||
|
|
@ -14,7 +14,7 @@ class Push
|
||||||
protected $to = array();
|
protected $to = array();
|
||||||
protected $subject = '';
|
protected $subject = '';
|
||||||
protected $content = '';
|
protected $content = '';
|
||||||
protected $click_action = '';
|
protected $metadata = [];
|
||||||
protected $data = [];
|
protected $data = [];
|
||||||
protected $errors = array();
|
protected $errors = array();
|
||||||
protected $success_tokens = array();
|
protected $success_tokens = array();
|
||||||
|
|
@ -205,7 +205,7 @@ class Push
|
||||||
*/
|
*/
|
||||||
public function setClickAction(string $click_action): bool
|
public function setClickAction(string $click_action): bool
|
||||||
{
|
{
|
||||||
$this->click_action = utf8_trim(utf8_clean($click_action));
|
$this->metadata['click_action'] = utf8_trim(utf8_clean($click_action));
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -216,7 +216,89 @@ class Push
|
||||||
*/
|
*/
|
||||||
public function getClickAction(): string
|
public function getClickAction(): string
|
||||||
{
|
{
|
||||||
return $this->click_action;
|
return $this->metadata['click_action'];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a sound to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $sound
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setSound(string $sound): bool
|
||||||
|
{
|
||||||
|
$this->metadata['sound'] = utf8_trim(utf8_clean($sound));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a badge to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $badge
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setBadge(string $badge): bool
|
||||||
|
{
|
||||||
|
$this->metadata['badge'] = utf8_trim(utf8_clean($badge));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an icon to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $icon
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setIcon(string $icon): bool
|
||||||
|
{
|
||||||
|
$this->metadata['icon'] = utf8_trim(utf8_clean($icon));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a tag to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $tag
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setTag(string $tag): bool
|
||||||
|
{
|
||||||
|
$this->metadata['tag'] = utf8_trim(utf8_clean($tag));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set a color to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $color
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setColor(string $color): bool
|
||||||
|
{
|
||||||
|
$this->metadata['color'] = utf8_trim(utf8_clean($color));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set an android-channel-id to associate with this push notification.
|
||||||
|
*
|
||||||
|
* @param string $android_channel_id
|
||||||
|
* @return bool
|
||||||
|
*/
|
||||||
|
public function setAndroidChannelId(string $android_channel_id): bool
|
||||||
|
{
|
||||||
|
$this->metadata['android_channel_id'] = utf8_trim(utf8_clean($android_channel_id));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get notification array
|
||||||
|
*
|
||||||
|
* @return array
|
||||||
|
*/
|
||||||
|
public function getNotifications(): array
|
||||||
|
{
|
||||||
|
return $this->metadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue