From 6d025330e96a07ba407b6dcc2e5812cace6704c3 Mon Sep 17 00:00:00 2001 From: Blade Barringer Date: Sun, 10 May 2015 16:48:48 -0500 Subject: [PATCH] Clean up spaces; remove console log --- website/src/controllers/pushNotifications.js | 70 +++++++++----------- 1 file changed, 33 insertions(+), 37 deletions(-) diff --git a/website/src/controllers/pushNotifications.js b/website/src/controllers/pushNotifications.js index fc576beefc..98ec0b5d82 100644 --- a/website/src/controllers/pushNotifications.js +++ b/website/src/controllers/pushNotifications.js @@ -7,50 +7,46 @@ var pushNotify = require('push-notify'); var gcmApiKey = nconf.get("PUSH_CONFIGS:GCM_SERVER_API_KEY"); var gcm = gcmApiKey ? pushNotify.gcm({ - apiKey: gcmApiKey, - retries: 3 + apiKey: gcmApiKey, + retries: 3 }) : undefined; if(gcm){ - gcm.on('transmitted', function (result, message, registrationId) { - console.info("transmitted", result, message, registrationId); - }); + gcm.on('transmitted', function (result, message, registrationId) { + console.info("transmitted", result, message, registrationId); + }); - gcm.on('transmissionError', function (error, message, registrationId) { - console.info("transmissionError", error, message, registrationId); - }); - gcm.on('updated', function (result, registrationId) { - console.info("updated", result, registrationId); - }); + gcm.on('transmissionError', function (error, message, registrationId) { + console.info("transmissionError", error, message, registrationId); + }); + gcm.on('updated', function (result, registrationId) { + console.info("updated", result, registrationId); + }); } api.sendNotify = function(user, title, msg, timeToLive){ - timeToLive = timeToLive || 15; + timeToLive = timeToLive || 15; - _.forEach(user.pushDevices, function(pushDevice){ - switch(pushDevice.type){ - case "android": - if(gcm){ - console.info("sending", title, msg); - console.info(pushDevice); + _.forEach(user.pushDevices, function(pushDevice){ + switch(pushDevice.type){ + case "android": + if(gcm){ + gcm.send({ + registrationId: pushDevice.regId, + //collapseKey: 'COLLAPSE_KEY', + delayWhileIdle: true, + timeToLive: timeToLive, + data: { + title: title, + message: msg + } + }); + } + break; - gcm.send({ - registrationId: pushDevice.regId, - //collapseKey: 'COLLAPSE_KEY', - delayWhileIdle: true, - timeToLive: timeToLive, - data: { - title: title, - message: msg - } - }); - } - - break; - - case "ios": - break; - } - }); -}; \ No newline at end of file + case "ios": + break; + } + }); +};