Skip to content

Commit a1e67ce

Browse files
Mohit TejaniMohit Tejani
authored andcommitted
replaced pn_gcm with pn_fcm for push notification payload builder utility
1 parent f166eba commit a1e67ce

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

lib/types/index.d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4006,7 +4006,7 @@ declare namespace PubNub {
40064006
};
40074007

40084008
/**
4009-
* Payload for `pn_gcm` field in published message.
4009+
* Payload for `pn_fcm` field in published message.
40104010
*/
40114011
type FCMPayload = {
40124012
/**
@@ -4400,7 +4400,7 @@ declare namespace PubNub {
44004400
*/
44014401
buildPayload(platforms: ('apns' | 'apns2' | 'fcm')[]): {
44024402
pn_apns?: APNSPayload;
4403-
pn_gcm?: FCMPayload;
4403+
pn_fcm?: FCMPayload;
44044404
pn_debug?: boolean;
44054405
};
44064406
}
@@ -8927,7 +8927,7 @@ declare namespace PubNub {
89278927
/**
89288928
* Push Notifications gateway type.
89298929
*/
8930-
pushGateway: 'gcm';
8930+
pushGateway: 'fcm';
89318931
};
89328932

89338933
/**

src/core/components/push_payload.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,7 @@ type PubNubAPNS2Target = Omit<APNS2Target, 'excludedDevices'> & {
155155

156156
// region FCM
157157
/**
158-
* Payload for `pn_gcm` field in published message.
158+
* Payload for `pn_fcm` field in published message.
159159
*/
160160
type FCMPayload = {
161161
/**
@@ -975,7 +975,7 @@ class NotificationsPayload {
975975
* specified platforms.
976976
*/
977977
buildPayload(platforms: ('apns' | 'apns2' | 'fcm')[]) {
978-
const payload: { pn_apns?: APNSPayload; pn_gcm?: FCMPayload; pn_debug?: boolean } = {};
978+
const payload: { pn_apns?: APNSPayload; pn_fcm?: FCMPayload; pn_debug?: boolean } = {};
979979

980980
if (platforms.includes('apns') || platforms.includes('apns2')) {
981981
// @ts-expect-error Override APNS version.
@@ -988,7 +988,7 @@ class NotificationsPayload {
988988
if (platforms.includes('fcm')) {
989989
const fcmPayload = this.fcm.toObject();
990990

991-
if (fcmPayload && Object.keys(fcmPayload).length) payload.pn_gcm = fcmPayload;
991+
if (fcmPayload && Object.keys(fcmPayload).length) payload.pn_fcm = fcmPayload;
992992
}
993993

994994
if (Object.keys(payload).length && this._debugging) payload.pn_debug = true;

test/dist/react-native.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -269,7 +269,7 @@ describe('#distribution test (rkt-native)', function () {
269269

270270
expect(payload).to.be.an('object');
271271
expect(payload).to.have.property('pn_apns');
272-
expect(payload).to.have.property('pn_gcm');
272+
expect(payload).to.have.property('pn_fcm');
273273
expect(payload.pn_apns.aps.alert.title).to.equal('Test Title');
274274
expect(payload.pn_apns.aps.alert.body).to.equal('Test Body');
275275
});

test/unit/notifications_payload.test.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ describe('#notifications helper', () => {
9595
pn_apns: {
9696
aps: { alert: { title: expectedTitle, body: expectedBody } },
9797
},
98-
pn_gcm: {
98+
pn_fcm: {
9999
notification: { title: expectedTitle, body: expectedBody },
100100
},
101101
};
@@ -120,7 +120,7 @@ describe('#notifications helper', () => {
120120
},
121121
],
122122
},
123-
pn_gcm: {
123+
pn_fcm: {
124124
notification: { title: expectedTitle, body: expectedBody },
125125
},
126126
};

0 commit comments

Comments
 (0)