예제 #1
0
 /**
  * @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);
 }
예제 #2
0
 /**
  * @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);
 }
예제 #3
0
파일: MessageTest.php 프로젝트: genkgo/push
 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());
 }
예제 #4
0
 /**
  * @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());
 }