@parse/node-apn
Advanced tools
Comparing version 6.1.0 to 6.2.0
@@ -0,1 +1,8 @@ | ||
# [6.2.0](https://github.com/parse-community/node-apn/compare/6.1.0...6.2.0) (2024-09-25) | ||
### Features | ||
* Add fields `subtitleLocKey`, `subtitleLocArgs` for localized subtitle and arguments in notifications ([#154](https://github.com/parse-community/node-apn/issues/154)) ([c885405](https://github.com/parse-community/node-apn/commit/c885405e10c9d1ec15968c42d410ce4f56dfbf04)) | ||
# [6.1.0](https://github.com/parse-community/node-apn/compare/6.0.2...6.1.0) (2024-09-16) | ||
@@ -2,0 +9,0 @@ |
@@ -81,2 +81,4 @@ /// <reference types="node" /> | ||
"title-loc-args"?: any[] | ||
"subtitle-loc-key"?: string | ||
"subtitle-loc-args"?: any[] | ||
action?: string | ||
@@ -177,2 +179,4 @@ "action-loc-key"?: string | ||
"title-loc-args"?: string[]; | ||
"subtitle-loc-key"?: string; | ||
"subtitle-loc-args"?: string[]; | ||
"action-loc-key"?: string; | ||
@@ -179,0 +183,0 @@ "loc-key"?: string; |
@@ -52,2 +52,12 @@ module.exports = { | ||
set subtitleLocKey(value) { | ||
this.prepareAlert(); | ||
this.aps.alert['subtitle-loc-key'] = value; | ||
}, | ||
set subtitleLocArgs(value) { | ||
this.prepareAlert(); | ||
this.aps.alert['subtitle-loc-args'] = value; | ||
}, | ||
set action(value) { | ||
@@ -54,0 +64,0 @@ this.prepareAlert(); |
@@ -39,2 +39,4 @@ /** | ||
'titleLocArgs', | ||
'subtitleLocKey', | ||
'subtitleLocArgs', | ||
'action', | ||
@@ -41,0 +43,0 @@ 'actionLocKey', |
{ | ||
"name": "@parse/node-apn", | ||
"description": "An interface to the Apple Push Notification service for Node.js", | ||
"version": "6.1.0", | ||
"version": "6.2.0", | ||
"author": "Parse Platform, Andrew Naylor <argon@mkbot.net>", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -264,2 +264,3 @@ const Notification = require('../../lib/notification'); | ||
}); | ||
describe('titleLocKey', function () { | ||
@@ -367,2 +368,104 @@ it('sets the aps.alert.title-loc-key property', function () { | ||
describe('subtitleLocKey', function () { | ||
it('sets the aps.alert.subtitle-loc-key property', function () { | ||
note.subtitleLocKey = 'Warning'; | ||
expect(compiledOutput()).to.have.nested.deep.property('aps.alert.subtitle-loc-key', 'Warning'); | ||
}); | ||
context('alert is already an object', function () { | ||
beforeEach(function () { | ||
note.alert = { body: 'Test', 'launch-image': 'test.png' }; | ||
note.subtitleLocKey = 'Warning'; | ||
}); | ||
it('contains all expected properties', function () { | ||
expect(compiledOutput()).to.have.nested.deep.property('aps.alert').that.deep.equals({ | ||
body: 'Test', | ||
'launch-image': 'test.png', | ||
'subtitle-loc-key': 'Warning', | ||
}); | ||
}); | ||
}); | ||
context('alert is already a string', function () { | ||
beforeEach(function () { | ||
note.alert = 'Hello, world'; | ||
note.subtitleLocKey = 'Warning'; | ||
}); | ||
it('retains the alert body correctly', function () { | ||
expect(compiledOutput()).to.have.nested.deep.property('aps.alert.body', 'Hello, world'); | ||
}); | ||
it('sets the aps.alert.subtitle-loc-key property', function () { | ||
expect(compiledOutput()).to.have.nested.deep.property( | ||
'aps.alert.subtitle-loc-key', | ||
'Warning' | ||
); | ||
}); | ||
}); | ||
describe('setAlert', function () { | ||
it('is chainable', function () { | ||
expect(note.setSubtitleLocKey('greeting')).to.equal(note); | ||
expect(compiledOutput()).to.have.nested.deep.property( | ||
'aps.alert.subtitle-loc-key', | ||
'greeting' | ||
); | ||
}); | ||
}); | ||
}); | ||
describe('subtitleLocArgs', function () { | ||
it('sets the aps.alert.subtitle-loc-args property', function () { | ||
note.subtitleLocArgs = ['arg1', 'arg2']; | ||
expect(compiledOutput()) | ||
.to.have.nested.deep.property('aps.alert.subtitle-loc-args') | ||
.that.deep.equals(['arg1', 'arg2']); | ||
}); | ||
context('alert is already an object', function () { | ||
beforeEach(function () { | ||
note.alert = { body: 'Test', 'launch-image': 'test.png' }; | ||
note.subtitleLocArgs = ['Hi there']; | ||
}); | ||
it('contains all expected properties', function () { | ||
expect(compiledOutput()) | ||
.to.have.nested.deep.property('aps.alert') | ||
.that.deep.equals({ | ||
body: 'Test', | ||
'launch-image': 'test.png', | ||
'subtitle-loc-args': ['Hi there'], | ||
}); | ||
}); | ||
}); | ||
context('alert is already a string', function () { | ||
beforeEach(function () { | ||
note.alert = 'Hello, world'; | ||
note.subtitleLocArgs = ['Hi there']; | ||
}); | ||
it('retains the alert body', function () { | ||
expect(compiledOutput()).to.have.nested.deep.property('aps.alert.body', 'Hello, world'); | ||
}); | ||
it('sets the aps.alert.subtitle-loc-args property', function () { | ||
expect(compiledOutput()) | ||
.to.have.nested.deep.property('aps.alert.subtitle-loc-args') | ||
.that.deep.equals(['Hi there']); | ||
}); | ||
}); | ||
describe('setTitleLocArgs', function () { | ||
it('is chainable', function () { | ||
expect(note.setTitleLocArgs(['iPhone 6s'])).to.equal(note); | ||
expect(compiledOutput()) | ||
.to.have.nested.deep.property('aps.alert.title-loc-args') | ||
.that.deep.equals(['iPhone 6s']); | ||
}); | ||
}); | ||
}); | ||
describe('action', function () { | ||
@@ -369,0 +472,0 @@ it('sets the aps.alert.action property', function () { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
403619
92
6321