Skip to content

Commit

Permalink
v8.1.0
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewBarba committed Feb 4, 2020
1 parent 17db73a commit e954128
Show file tree
Hide file tree
Showing 5 changed files with 378 additions and 423 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,12 @@ Change Log

---

## [8.0.0](https://github.com/AndrewBarba/apns2/releases/tag/7.0.0)
## [8.1.0](https://github.com/AndrewBarba/apns2/releases/tag/8.1.0)

1. Add missing TypeScript interface for `NotificationOptions`
2. Remove lodash dependency

## [8.0.0](https://github.com/AndrewBarba/apns2/releases/tag/8.0.0)

1. Require Node.js v10 or higher

Expand Down
18 changes: 18 additions & 0 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,24 @@ declare interface APNSOptions {
connections?: number
}

declare interface NotificationOptions {
aps?: any;
actions?: NotificationAction[];
badge?: string;
body?: string;
data?: any;
dir?: NotificationDirection;
icon?: string;
image?: string;
lang?: string;
renotify?: boolean;
requireInteraction?: boolean;
silent?: boolean;
tag?: string;
timestamp?: number;
vibrate?: VibratePattern;
}

declare interface NotificationPriority {
immediate: number
throttled: number
Expand Down
11 changes: 5 additions & 6 deletions lib/notifications/notification.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
const _ = require('lodash')
const pushType = require('./constants/push-type')
const priority = require('./constants/priority')

Expand Down Expand Up @@ -106,27 +105,27 @@ class Notification {
}

// Check for "silent" notification
if (_.isBoolean(this._options.contentAvailable)) {
if (typeof this._options.contentAvailable === 'boolean') {
result.aps[`content-available`] = 1
}

// Check for sound
if (_.isString(this._options.sound)) {
if (typeof this._options.sound === 'string') {
result.aps.sound = this._options.sound
}

// Check for category
if (_.isString(this._options.category)) {
if (typeof this._options.category === 'string') {
result.aps.category = this._options.category
}

// Check for badge
if (_.isNumber(this._options.badge)) {
if (typeof this._options.badge === 'number') {
result.aps.badge = this._options.badge
}

// Check for threadId
if (_.isString(this._options.threadId)) {
if (typeof this._options.threadId === 'string') {
result.aps[`thread-id`] = this._options.threadId
}

Expand Down
7 changes: 3 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "apns2",
"version": "8.0.0",
"version": "8.1.0",
"description": "Node client for connecting to Apple's Push Notification Service using the new HTTP/2 protocol with JSON web tokens.",
"author": "Andrew Barba <[email protected]>",
"main": "lib/apns.js",
Expand All @@ -14,12 +14,11 @@
},
"dependencies": {
"jsonwebtoken": "^8.4.0",
"lodash": "^4.17.11",
"tarn": "^2.0.0"
},
"devDependencies": {
"eslint": "^6.3.0",
"mocha": "^6.2.0",
"eslint": "^6.8.0",
"mocha": "^7.0.1",
"should": "^13.2.3"
},
"scripts": {
Expand Down
Loading

0 comments on commit e954128

Please sign in to comment.