Clean up push metadata

빈 값은 제외하고 전송하도록 보완합니다.
즉, 기존에 세팅된 값을 제거하려면 빈 값을 세팅하면 됩니다.
This commit is contained in:
Kijin Sung 2021-12-29 22:37:20 +09:00
parent 5bbda4b532
commit 9d6e54f2f6
2 changed files with 5 additions and 3 deletions

View file

@ -59,7 +59,7 @@ class FCM extends Base implements \Rhymix\Framework\Drivers\PushInterface
);
// Set notification
$notification = $message->getNotifications() ?? [];
$notification = $message->getMetadata();
$notification['title'] = $message->getSubject();
$notification['body'] = $message->getContent();

View file

@ -296,9 +296,11 @@ class Push
*
* @return array
*/
public function getNotifications(): array
public function getMetadata(): array
{
return $this->metadata;
return array_filter($this->metadata, function($val) {
return $val !== '';
});
}
/**