diff options
| author | Jules Laplace <julescarbon@gmail.com> | 2017-09-25 19:07:54 +0200 |
|---|---|---|
| committer | Jules Laplace <julescarbon@gmail.com> | 2017-09-25 19:07:54 +0200 |
| commit | bdba73ab985fdd6112f36dff02cd0eff937759b1 (patch) | |
| tree | a4af98001c26e53ff932e5650459059fb3b0583c | |
| parent | 709af63b290214b79271d96518e2ed51468e09f3 (diff) | |
test
| -rw-r--r-- | lib/okpush/apn.js | 2 | ||||
| -rw-r--r-- | lib/okpush/db.js | 5 | ||||
| -rw-r--r-- | lib/okpush/index.js | 2 |
3 files changed, 5 insertions, 4 deletions
diff --git a/lib/okpush/apn.js b/lib/okpush/apn.js index c1430012..da883602 100644 --- a/lib/okpush/apn.js +++ b/lib/okpush/apn.js @@ -18,7 +18,7 @@ function push (channel, note) { console.error("Error fetching devices:", err) return } - // console.log(note, tokens) + console.log(note, tokens) apnProvider.send(note, tokens).then( function (response) { // response.sent.forEach( function (token) { // notificationSent(user, token) diff --git a/lib/okpush/db.js b/lib/okpush/db.js index 09afdf34..4e000725 100644 --- a/lib/okpush/db.js +++ b/lib/okpush/db.js @@ -109,7 +109,7 @@ function getDeviceCount (channels, cb) { /* notifications */ -function addNotification (channel, cb) { +function addNotification (channel, message, cb) { var now = new Date Channel.findOrCreate({channel: channel}, {last_push: now}, function(err, note, created) { if (err) { @@ -123,8 +123,9 @@ function addNotification (channel, cb) { } cb(null, note) }) - new Notification ({ + return new Notification ({ channel: channel, + message: message || "", date: now, }).save() } diff --git a/lib/okpush/index.js b/lib/okpush/index.js index a0211bed..c202c681 100644 --- a/lib/okpush/index.js +++ b/lib/okpush/index.js @@ -131,7 +131,7 @@ function OKPush (options) { } var note = apn.buildPayload(opt, options.config.bundleId) apn.push('hub', note) - db.addNotification(channel, function(){ + db.addNotification('custom', function(){ res.sendStatus(200) }) }) |
