mirror of
https://gitlab.silvrtree.co.uk/martind2000/SODashServer.git
synced 2025-03-11 07:20:00 +00:00
Apple Push notifications. Trying something else. again
This commit is contained in:
parent
13b7bd8b27
commit
51800e5fd8
@ -122,6 +122,20 @@ var officeController = function(neweventbus) {
|
||||
});
|
||||
};
|
||||
|
||||
officeController.prototype.sendiOSAPN = function(packet) {
|
||||
logger.info('Sending the same notification each of the devices with one call to pushNotification.');
|
||||
var note = new apn.notification();
|
||||
var now = new Date();
|
||||
note.setAlertText(packet.msg);
|
||||
note.setAlertTitle('Smart Office');
|
||||
note.setBadge(1);
|
||||
note.setSound('dong.aiff');
|
||||
note.badge = 1;
|
||||
|
||||
apnService.pushNotification(note, this.iosTokens);
|
||||
};
|
||||
|
||||
|
||||
officeController.prototype.announceMeetingEnd = function(meeting) {
|
||||
logger.debug('announceMeetingEnd',meeting);
|
||||
var msg = ['The meeting "', meeting.summary, '" is due to end in five minutes. Would you like to extend it by another five minutes?'].join('');
|
||||
@ -134,23 +148,27 @@ officeController.prototype.announceMeetingEnd = function(meeting) {
|
||||
collapse_key: 'test',
|
||||
data: {
|
||||
key1: 'value1'
|
||||
},
|
||||
},
|
||||
delay_while_idle: true,
|
||||
time_to_live: 34,
|
||||
dry_run: false
|
||||
});
|
||||
});
|
||||
|
||||
this.sendiOSAPN(packet);
|
||||
|
||||
sender.sendMessage(message.toJSON(), '', true, function(err, data) {
|
||||
if (!err) {
|
||||
logger.info('Message sent');
|
||||
logger.debug(data);
|
||||
// do something
|
||||
// Do something
|
||||
} else {
|
||||
logger.error('Message failed');
|
||||
logger.error(err);
|
||||
// handle error
|
||||
// Handle error
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user