Skip to content

Commit b45ae94

Browse files
authored
Partially Revert #64 to fix #69 (#70)
1 parent c2f085d commit b45ae94

File tree

1 file changed

+4
-10
lines changed

1 file changed

+4
-10
lines changed

src/FcmChannel.php

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,14 @@
99
use Kreait\Firebase\Messaging as MessagingClient;
1010
use Kreait\Firebase\Messaging\CloudMessage;
1111
use Kreait\Firebase\Messaging\Message;
12+
use Kreait\Laravel\Firebase\Facades\FirebaseMessaging;
1213
use NotificationChannels\Fcm\Exceptions\CouldNotSendNotification;
1314
use Throwable;
1415

1516
class FcmChannel
1617
{
1718
const MAX_TOKEN_PER_REQUEST = 500;
1819

19-
/**
20-
* @var MessagingClient
21-
*/
22-
protected $client;
23-
2420
/***
2521
* @var Dispatcher
2622
*/
@@ -29,12 +25,10 @@ class FcmChannel
2925
/**
3026
* FcmChannel constructor.
3127
*
32-
* @param MessagingClient $client
3328
* @param Dispatcher $dispatcher
3429
*/
35-
public function __construct(MessagingClient $client, Dispatcher $dispatcher)
30+
public function __construct(Dispatcher $dispatcher)
3631
{
37-
$this->client = $client;
3832
$this->events = $dispatcher;
3933
}
4034

@@ -99,7 +93,7 @@ protected function sendToFcm(Message $fcmMessage, $token)
9993
$fcmMessage->setToken($token);
10094
}
10195

102-
return $this->client->send($fcmMessage);
96+
return FirebaseMessaging::send($fcmMessage);
10397
}
10498

10599
/**
@@ -111,7 +105,7 @@ protected function sendToFcm(Message $fcmMessage, $token)
111105
*/
112106
protected function sendToFcmMulticast($fcmMessage, array $tokens)
113107
{
114-
return $this->client->sendMulticast($fcmMessage, $tokens);
108+
return FirebaseMessaging::sendMulticast($fcmMessage, $tokens);
115109
}
116110

117111
/**

0 commit comments

Comments
 (0)