From b31c0b97bf61d75c88de4b9bc22ad0a3e47b009b Mon Sep 17 00:00:00 2001 From: Alexander Friedl Date: Thu, 6 Jan 2022 22:13:20 +0100 Subject: [PATCH] Support silent high priority notifications for GCM --- src/sendGCM.js | 2 +- test/send/sendGCM.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/sendGCM.js b/src/sendGCM.js index 2a3afde..aa28a0d 100644 --- a/src/sendGCM.js +++ b/src/sendGCM.js @@ -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), diff --git a/test/send/sendGCM.js b/test/send/sendGCM.js index ce1595b..1c6e3aa 100644 --- a/test/send/sendGCM.js +++ b/test/send/sendGCM.js @@ -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();