Skip to content

Commit

Permalink
clean up GCM refs
Browse files Browse the repository at this point in the history
  • Loading branch information
nsakaimbo committed Aug 22, 2024
1 parent 8887df3 commit 28f1e66
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 29 deletions.
14 changes: 1 addition & 13 deletions lib/push-notifications.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
"use strict";

var _sendGCM = _interopRequireDefault(require("./sendGCM"));

var _sendAPN = _interopRequireDefault(require("./sendAPN"));

var _sendFCM = _interopRequireDefault(require("./sendFCM"));
Expand All @@ -25,7 +23,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
class PN {
constructor(options) {
this.setOptions(options);
this.useFcmOrGcmMethod = this.settings.isLegacyGCM ? _constants.GCM_METHOD : _constants.FCM_METHOD;
this.useFcmOrGcmMethod = _constants.FCM_METHOD;
}

setOptions(opts) {
Expand Down Expand Up @@ -108,7 +106,6 @@ class PN {

send(_regIds, data, callback) {
const promises = [];
const regIdsGCM = [];
const regIdsFCM = [];
const regIdsAPN = [];
const regIdsWNS = [];
Expand All @@ -124,8 +121,6 @@ class PN {

if (pushMethod === _constants.WEB_METHOD) {
regIdsWebPush.push(regId);
} else if (pushMethod === _constants.GCM_METHOD) {
regIdsGCM.push(regId);
} else if (pushMethod === _constants.FCM_METHOD) {
regIdsFCM.push(regId);
} else if (pushMethod === _constants.WNS_METHOD) {
Expand All @@ -140,12 +135,6 @@ class PN {
});

try {
// Android GCM / FCM (Android/iOS) Legacy
if (regIdsGCM.length > 0) {
promises.push(this.sendWith(_sendGCM.default, regIdsGCM, data));
} // FCM (Android/iOS)


if (regIdsFCM.length > 0) {
promises.push(this.sendWith(_sendFCM.default, regIdsFCM, data));
} // iOS APN
Expand Down Expand Up @@ -219,6 +208,5 @@ module.exports = PN;
module.exports.WEB = _constants.WEB_METHOD;
module.exports.WNS = _constants.WNS_METHOD;
module.exports.ADM = _constants.ADM_METHOD;
module.exports.GCM = _constants.GCM_METHOD;
module.exports.FCM = _constants.FCM_METHOD;
module.exports.APN = _constants.APN_METHOD;
15 changes: 1 addition & 14 deletions src/push-notifications.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
/* eslint-disable import/no-import-module-exports */

import sendGCM from './sendGCM';
import APN from './sendAPN';
import sendFCM from './sendFCM';
import sendADM from './sendADM';
Expand All @@ -13,17 +12,14 @@ import {
WEB_METHOD,
WNS_METHOD,
ADM_METHOD,
GCM_METHOD,
APN_METHOD,
FCM_METHOD,
} from './constants';

class PN {
constructor(options) {
this.setOptions(options);
this.useFcmOrGcmMethod = this.settings.isLegacyGCM
? GCM_METHOD
: FCM_METHOD;
this.useFcmOrGcmMethod = FCM_METHOD;
}

setOptions(opts) {
Expand Down Expand Up @@ -90,7 +86,6 @@ class PN {

send(_regIds, data, callback) {
const promises = [];
const regIdsGCM = [];
const regIdsFCM = [];
const regIdsAPN = [];
const regIdsWNS = [];
Expand All @@ -105,8 +100,6 @@ class PN {

if (pushMethod === WEB_METHOD) {
regIdsWebPush.push(regId);
} else if (pushMethod === GCM_METHOD) {
regIdsGCM.push(regId);
} else if (pushMethod === FCM_METHOD) {
regIdsFCM.push(regId);
} else if (pushMethod === WNS_METHOD) {
Expand All @@ -121,11 +114,6 @@ class PN {
});

try {
// Android GCM / FCM (Android/iOS) Legacy
if (regIdsGCM.length > 0) {
promises.push(this.sendWith(sendGCM, regIdsGCM, data));
}

// FCM (Android/iOS)
if (regIdsFCM.length > 0) {
promises.push(this.sendWith(sendFCM, regIdsFCM, data));
Expand Down Expand Up @@ -203,6 +191,5 @@ module.exports = PN;
module.exports.WEB = WEB_METHOD;
module.exports.WNS = WNS_METHOD;
module.exports.ADM = ADM_METHOD;
module.exports.GCM = GCM_METHOD;
module.exports.FCM = FCM_METHOD;
module.exports.APN = APN_METHOD;
2 changes: 0 additions & 2 deletions test/push-notifications/regIds.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import { expect } from 'chai'; // eslint-disable-line import/no-extraneous-dependencies
import sinon from 'sinon'; // eslint-disable-line import/no-extraneous-dependencies
import PN from '../../src';
import sendGCM from '../../src/sendGCM';
import sendADM from '../../src/sendADM';
import sendWNS from '../../src/sendWNS';
import sendWeb from '../../src/sendWeb';
Expand Down Expand Up @@ -53,7 +52,6 @@ describe('push-notifications: call with registration ids for android, ios, windo
case 0:
case 1:
case 2:
expect(method).to.equal(sendGCM);
break;

case 3:
Expand Down

0 comments on commit 28f1e66

Please sign in to comment.