Apple Push notifications. Trying something else. again

This commit is contained in:
Martin Donnelly 2016-04-29 13:54:01 +01:00
parent 0945cb17ac
commit 13b7bd8b27
2 changed files with 23 additions and 6 deletions

2
app.js
View File

@ -222,7 +222,7 @@ app.post('/api/v1/register/ios', function(req, res) {
registrationId = body['registrationId'];
logger.debug(registrationId);
cal.registeriOSToken(id);
cal.registeriOSToken(registrationId);
/* if (iosTokens.indexOf(registrationId) === -1) {
iosTokens.push(registrationId);

View File

@ -347,11 +347,24 @@ var SOController = (function() {
//
module.init = function() {
console.log('-=# A #=-');
attachClicks();
console.log('-=# B #=-');
clock();
console.log('-=# C #=-');
weatherClock();
console.log('-=# D #=-');
soWebSocket = new SOWEBSOCKET(this);
setupPush();
console.log('-=# E #=-');
// Setup iOS notifications
console.log('device.platform', device.platform);
console.log('-=# F #=-');
if (device.platform === 'iOS' || device.platform === 'ios') {
console.log('-=# F.2 #=-');
setupPushNotifications();
}
console.log('-=# G #=-');
};
module.updateCalendar = function(data) {
@ -366,8 +379,6 @@ var SOController = (function() {
if (window.cordova && !(window.cordova instanceof HTMLElement)) {
if (device.platform === 'android' || device.platform === 'Android') {
cordovaNotify(d);
} else if (device.platform === 'iOS' || device.platform === 'ios') {
setupPushNotifications();
}
} else {
browserNotify(d);
@ -382,11 +393,17 @@ function onDeviceReady() {
SOController.init();
}
;(function() {
if (window.cordova && !(window.cordova instanceof HTMLElement)) {
document.addEventListener('deviceready', onDeviceReady, false);
}
/*;(function() {
if (window.cordova && !(window.cordova instanceof HTMLElement)) {
document.addEventListener('deviceready', onDeviceReady, false);
} else {
onDeviceReady();
Notification.requestPermission();
}
})();
})();*/