From d863f2e6ce2a58ee92371d69ad8966dd9927e90f Mon Sep 17 00:00:00 2001 From: Corey Date: Sun, 15 Sep 2024 18:39:16 -0700 Subject: [PATCH 1/2] feat: Add `dismissal-date` property to Live Activity notifications (#152) --- doc/notification.markdown | 1 + lib/notification/apsProperties.js | 6 ++++++ lib/notification/index.js | 1 + test/notification/apsProperties.js | 26 ++++++++++++++++++++++++++ 4 files changed, 34 insertions(+) diff --git a/doc/notification.markdown b/doc/notification.markdown index 8916fe44..681727a3 100644 --- a/doc/notification.markdown +++ b/doc/notification.markdown @@ -112,6 +112,7 @@ This table shows the name of the setter, with the key-path of the underlying pro | `staleDate` | `aps.staleDate` | `Number` | | `event` | `aps.event` | `String` | | `contentState` | `aps.content-state` | `Object` | +| `dismissalDate` | `aps.dismissal-date` | `Number` | | `mdm` | `mdm` | `String` | When the notification is transmitted these properties will be added to the output before encoding. diff --git a/lib/notification/apsProperties.js b/lib/notification/apsProperties.js index 8381becc..393e65ed 100644 --- a/lib/notification/apsProperties.js +++ b/lib/notification/apsProperties.js @@ -113,6 +113,12 @@ module.exports = { } }, + set dismissalDate(value) { + if (typeof value === 'number' || value === undefined) { + this.aps['dismissal-date'] = value; + } + }, + set contentAvailable(value) { if (value === true || value === 1) { this.aps['content-available'] = 1; diff --git a/lib/notification/index.js b/lib/notification/index.js index 4b4f9b50..957502ac 100644 --- a/lib/notification/index.js +++ b/lib/notification/index.js @@ -54,6 +54,7 @@ Notification.prototype = require('./apsProperties'); 'staleDate', 'event', 'contentState', + 'dismissalDate' ].forEach(propName => { const methodName = 'set' + propName[0].toUpperCase() + propName.slice(1); Notification.prototype[methodName] = function (value) { diff --git a/test/notification/apsProperties.js b/test/notification/apsProperties.js index 04bbb727..c3267321 100644 --- a/test/notification/apsProperties.js +++ b/test/notification/apsProperties.js @@ -858,6 +858,32 @@ describe('Notification', function () { }); }); + describe('dismissal-date', function () { + it('defaults to undefined', function () { + expect(compiledOutput()).to.not.have.nested.property('aps.dismissal-date'); + }); + + it('can be set to a number', function () { + note.dismissalDate = 123456; + + expect(compiledOutput()).to.have.nested.property('aps.dismissal-date', 123456); + }); + + it('can be set to undefined', function () { + note.dismissalDate = 123456; + note.dismissalDate = undefined; + + expect(compiledOutput()).to.not.have.nested.property('aps.dismissal-date'); + }); + + describe('setDismissalDate', function () { + it('is chainable', function () { + expect(note.setDismissalDate(123456)).to.equal(note); + expect(compiledOutput()).to.have.nested.property('aps.dismissal-date', 123456); + }); + }); + }); + describe('timestamp', function () { it('defaults to undefined', function () { expect(compiledOutput()).to.not.have.nested.property('aps.timestamp'); From 9b173b49eefd1c2549d5e646d541550c01376e90 Mon Sep 17 00:00:00 2001 From: semantic-release-bot Date: Mon, 16 Sep 2024 01:39:43 +0000 Subject: [PATCH 2/2] chore(release): 6.1.0 [skip ci] # [6.1.0](https://github.com/parse-community/node-apn/compare/6.0.2...6.1.0) (2024-09-16) ### Features * Add `dismissal-date` property to Live Activity notifications ([#152](https://github.com/parse-community/node-apn/issues/152)) ([d863f2e](https://github.com/parse-community/node-apn/commit/d863f2e6ce2a58ee92371d69ad8966dd9927e90f)) --- CHANGELOG.md | 7 +++++++ package-lock.json | 2 +- package.json | 2 +- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 96b8193b..0b654db6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,10 @@ +# [6.1.0](https://github.com/parse-community/node-apn/compare/6.0.2...6.1.0) (2024-09-16) + + +### Features + +* Add `dismissal-date` property to Live Activity notifications ([#152](https://github.com/parse-community/node-apn/issues/152)) ([d863f2e](https://github.com/parse-community/node-apn/commit/d863f2e6ce2a58ee92371d69ad8966dd9927e90f)) + ## [6.0.2](https://github.com/parse-community/node-apn/compare/6.0.1...6.0.2) (2024-09-10) diff --git a/package-lock.json b/package-lock.json index 9a5e0438..00cbe5e1 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@parse/node-apn", - "version": "6.0.2", + "version": "6.1.0", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/package.json b/package.json index d32ff571..3f11b624 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@parse/node-apn", "description": "An interface to the Apple Push Notification service for Node.js", - "version": "6.0.2", + "version": "6.1.0", "author": "Parse Platform, Andrew Naylor ", "keywords": [ "apple",