Skip to content

Commit

Permalink
Merge pull request #171 from appfeel/fix/silent-high-priority-gcm
Browse files Browse the repository at this point in the history
Support silent high priority notifications for GCM
  • Loading branch information
alex-friedl authored Jan 6, 2022
2 parents b6294c5 + b31c0b9 commit 72c3364
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/sendGCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ const sendGCM = (regIds, data, settings) => {
const message = new gcm.Message({
// See https://developers.google.com/cloud-messaging/http-server-ref#table5
collapseKey: data.collapseKey,
priority: data.priority === 'normal' || data.silent ? 'normal' : 'high',
priority: data.priority === 'normal' ? 'normal' : 'high',
contentAvailable: data.silent ? true : data.contentAvailable || false,
delayWhileIdle: data.delayWhileIdle || false,
timeToLive: extractTimeToLive(data),
Expand Down
2 changes: 1 addition & 1 deletion test/send/sendGCM.js
Original file line number Diff line number Diff line change
Expand Up @@ -708,7 +708,7 @@ describe('push-notifications-gcm', () => {
expect(retries).to.be.a('number');
expect(message).to.be.instanceOf(gcm.Message);
expect(message.params.notification).to.be.undefined();
expect(message.params.priority).to.equal('normal');
expect(message.params.priority).to.equal('high');
expect(message.params.contentAvailable).to.be.true();
expect(message.params.data.testKey).to.eql('testValue');
expect(message.params.data.title).to.be.undefined();
Expand Down

0 comments on commit 72c3364

Please sign in to comment.