Skip to content

Commit 2fd10e5

Browse files
committed
Fixed send duplicate notifications.
1 parent 40a1543 commit 2fd10e5

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

src/FirebaseChannel.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,12 +53,14 @@ public function send($notifiable, Notification $notification)
5353

5454
$firebase = $notification->toFirebase($notifiable);
5555

56+
foreach ($devices as $device) {
57+
$this->message->addRecipient(new Device($device));
58+
}
59+
60+
$this->message->setNotification($firebase->notification)->setData($firebase->data);
61+
5662
try {
5763
foreach ($devices as $device) {
58-
$this->message->addRecipient(new Device($device))
59-
->setNotification($firebase->notification)
60-
->setData($firebase->data);
61-
6264
$response = $this->client->send($this->message);
6365
}
6466
} catch (Exception $e) {

0 commit comments

Comments
 (0)