Initial implementation of FCM HTTP v1 API

This commit is contained in:
Kijin Sung 2024-04-21 20:18:39 +09:00
parent 6641e6a6ef
commit 9699ed3416
2 changed files with 143 additions and 4 deletions

View file

@ -288,7 +288,7 @@ class Push
*/
public function setAndroidChannelId(string $android_channel_id): bool
{
$this->metadata['android_channel_id'] = utf8_trim(utf8_clean($android_channel_id));
$this->metadata['channel_id'] = utf8_trim(utf8_clean($android_channel_id));
return true;
}
@ -374,10 +374,11 @@ class Push
$tokens = $this->_getDeviceTokens();
$output = null;
// Android FCM
// FCM HTTP v1 or Legacy API
if(count($tokens->fcm))
{
$fcm_driver = $this->getDriver('fcm');
$fcm_driver_name = array_key_exists('fcmv1', config('push.types') ?: []) ? 'fcmv1' : 'fcm';
$fcm_driver = $this->getDriver($fcm_driver_name);
$output = $fcm_driver->send($this, $tokens->fcm);
$this->sent += count($output->success);
$this->success_tokens = $output ? $output->success : [];