/** * @param Message $message * @param RecipientInterface|AppleDeviceRecipient $recipient * @codeCoverageIgnore */ public function send(Message $message, RecipientInterface $recipient) { $appleMessage = new AppleMessage(); $appleMessage->setBody((string) $message->getBody()); $appleMessage->setDeviceToken($recipient->getToken()); $appleMessage->setCustomData($message->getExtra()); $notification = new Notification($this->connection); $notification->send($appleMessage); }
/** * @param Message $message * @param RecipientInterface $recipient * @codeCoverageIgnore */ public function send(Message $message, RecipientInterface $recipient) { $randomCollapse = rand(11, 100); $gcmMessage = new GcmMessage("{$randomCollapse}", ['message' => (string) $message->getBody(), 'title', (string) $message->getTitle()]); $extra = $message->getExtra(); foreach ($extra as $key => $value) { $gcmMessage->addData($key, $value); } $this->sender->sendMulti($gcmMessage, [$recipient->getToken()], $this->retries); }
public function testExtra() { $message = new Message(new Body('test')); $message1 = $message->withExtra('localId', 1); $message2 = $message->withExtra('localId', 2); $message3 = $message1->withExtra('more', 'data'); $this->assertCount(0, $message->getExtra()); $this->assertCount(1, $message1->getExtra()); $this->assertCount(1, $message2->getExtra()); $this->assertCount(2, $message3->getExtra()); }
/** * @param Message $message * @param RecipientInterface|WindowsDeviceRecipient $recipient * @codeCoverageIgnore */ public function send(Message $message, RecipientInterface $recipient) { $this->connection->pushToast($recipient->getToken(), (string) $message->getTitle(), (string) $message->getBody()); }