Skip to content

Commit 1d93ba4

Browse files
authored
feat: adds support for legacy FPM API use (#31)
Fix #28
1 parent 212d0ba commit 1d93ba4

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

config/expo-notifications.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,7 @@
2929
// https://docs.expo.dev/push-notifications/sending-notifications/#request-errors
3030
'push_notifications_per_request' => (int) env('EXPO_PUSH_NOTIFICATIONS_PER_REQUEST_LIMIT', 99),
3131
],
32+
// https://expo.dev/blog/expo-adds-support-for-fcm-http-v1-api
33+
'use_fcm_legacy_api' => (bool) env('EXPO_USE_FCM_LEGACY_API', false),
3234
],
3335
];

src/ExpoNotificationsService.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ final class ExpoNotificationsService implements ExpoNotificationsServiceInterfac
2323
{
2424
public const SEND_NOTIFICATION_ENDPOINT = '/send';
2525

26+
public const USE_FCM_LEGACY_API_QUERY_PARAM = 'useFcmV1';
27+
2628
private PendingRequest $http;
2729

2830
private ?Collection $expoMessages;
@@ -50,6 +52,13 @@ public function __construct(
5052
'content-type' => 'application/json',
5153
])->baseUrl($apiUrl);
5254

55+
// https://expo.dev/blog/expo-adds-support-for-fcm-http-v1-api
56+
if (config('expo-notifications.service.use_fcm_legacy_api')) {
57+
$this->http->withQueryParameters([
58+
self::USE_FCM_LEGACY_API_QUERY_PARAM => true,
59+
]);
60+
}
61+
5362
$this->tickets = collect();
5463
}
5564

0 commit comments

Comments
 (0)