File tree Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Expand file tree Collapse file tree 1 file changed +13
-0
lines changed Original file line number Diff line number Diff line change @@ -9,6 +9,13 @@ import { randomString } from './PushAdapterUtils';
99const LOG_PREFIX = 'parse-server-push-adapter FCM' ;
1010const FCMRegistrationTokensMax = 500 ;
1111const FCMTimeToLiveMax = 4 * 7 * 24 * 60 * 60 ; // FCM allows a max of 4 weeks
12+ const apnsIntegerDataKeys = [
13+ 'badge' ,
14+ 'content-available' ,
15+ 'mutable-content' ,
16+ 'priority' ,
17+ 'expiration_time' ,
18+ ] ;
1219
1320export default function FCM ( args , pushType ) {
1421 if ( typeof args !== 'object' || ! args . firebaseServiceAccount ) {
@@ -242,6 +249,12 @@ function _GCMToFCMPayload(requestData, timeStamp) {
242249 }
243250
244251 if ( requestData . hasOwnProperty ( 'data' ) ) {
252+ // FCM gives an error on send if we have apns keys that should have integer values
253+ for ( const key of apnsIntegerDataKeys ) {
254+ if ( requestData . data . hasOwnProperty ( key ) ) {
255+ requestData . data [ key ] = requestData . data [ key ] . toString ( ) ;
256+ }
257+ }
245258 androidPayload . android . data = requestData . data ;
246259 }
247260
You can’t perform that action at this time.
0 commit comments