summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/okpush/apn.js2
-rw-r--r--lib/okpush/db.js5
-rw-r--r--lib/okpush/index.js2
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)
})
})