11/* eslint no-underscore-dangle: ["error", { "allow": ["_id"] }] */
22
3- import _ from 'lodash' ;
4- import apn from 'apn' ;
5- import gcm from 'node-gcm' ;
3+ // import _ from 'lodash';
4+ // import apn from 'apn';
5+ // import gcm from 'node-gcm';
6+ // import util from 'util';
67
7- import apnProvider from './apn' ;
8- import gcmProvider from './gcm' ;
8+ // import apnProvider from './apn';
9+ // import gcmProvider from './gcm';
910import UserModel from '../../models/User' ;
1011import ProcedureModel from '../../models/Procedure' ;
12+ // import CONFIG from '../../config/constants';
1113
12- const sendNotifications = ( { tokenObjects, message } ) => {
13- const androidNotificationTokens = [ ] ;
14+ // TODO: remove both eslint-disable-line
15+ const sendNotifications = ( { tokenObjects, message } ) => { // eslint-disable-line
16+ // Disable Push Notifications
17+ return ; // eslint-disable-line
18+ /* const androidNotificationTokens = [];
1419 tokenObjects.forEach(({ token, os }) => {
1520 switch (os) {
1621 case 'ios':
@@ -19,7 +24,7 @@ const sendNotifications = ({ tokenObjects, message }) => {
1924
2025 note.alert = message;
2126 // note.payload = { messageFrom: 'John Appleseed' };
22- note . topic = 'de.democracy-deutschland.clientapp' ;
27+ note.topic = CONFIG.APN_TOPIC ;
2328
2429 apnProvider.send(note, token).then((result) => {
2530 console.log('apnProvider.send', result);
@@ -54,7 +59,7 @@ const sendNotifications = ({ tokenObjects, message }) => {
5459 else console.log('gcmProvider', response);
5560 },
5661 );
57- }
62+ } */
5863} ;
5964
6065const newVote = async ( { procedureId } ) => {
@@ -104,8 +109,13 @@ const procedureUpdate = async ({ procedureId }) => {
104109
105110export { procedureUpdate , newVote , newPreperation } ;
106111
107- export default async ( { message, user } ) => {
108- let userId ;
112+ // TODO: remove both eslint-disable-line
113+ export default async ( { message, user } ) => { // eslint-disable-line
114+ // Disable Push Notifications
115+ return ; // eslint-disable-line
116+ // This function seems to be (partly) a duplicate of the sendNotifications function
117+ // refactor?
118+ /* let userId;
109119 if (_.isObject(user)) {
110120 userId = user._id;
111121 }
@@ -120,10 +130,10 @@ export default async ({ message, user }) => {
120130
121131 note.alert = message;
122132 // note.payload = { messageFrom: 'John Appleseed' };
123- note . topic = 'de.democracy-deutschland.clientapp' ;
133+ note.topic = CONFIG.APN_TOPIC ;
124134
125135 apnProvider.send(note, token).then((result) => {
126- console . log ( 'apnProvider.send' , result ) ;
136+ console.log('apnProvider.send', util.inspect( result, false, null) );
127137 });
128138 }
129139 break;
@@ -156,5 +166,5 @@ export default async ({ message, user }) => {
156166 },
157167 );
158168 }
159- }
169+ } */
160170} ;
0 commit comments