fixed some android push shit

This commit is contained in:
Devin Smith 2015-03-23 13:43:02 -07:00
parent 10db962246
commit f225d3eac7

View File

@ -17,27 +17,13 @@ NGApp.factory('PushService', function($http, MainNavigationService, DriverOrders
}, false); }, false);
service.register = function(complete) { service.register = function(complete) {
if (device.platform == 'android' || device.platform == 'Android' || device.platform == 'amazon-fireos') {
parent.plugins.pushNotification.register( var params = {
function(id) { 'senderID': '1029345412368',
service.id = id; 'ecb': 'pushnotification'
console.debug('Push id: ' + id); };
} else {
$http({ var params = {
method: 'POST',
url: App.service + 'config',
data: {key: 'push-ios', value: service.id},
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
complete();
},
function() {
console.error('Failed registering push notifications', arguments);
App.alert('Failed to enable Push notifications. Please go to your push notification settings on your device and enable them for Cockpit.');
complete();
},
{
'badge': 'true', 'badge': 'true',
'sound': 'true', 'sound': 'true',
'alert': 'true', 'alert': 'true',
@ -80,7 +66,28 @@ NGApp.factory('PushService', function($http, MainNavigationService, DriverOrders
] ]
} }
] ]
};
} }
parent.plugins.pushNotification.register(
function(id) {
service.id = id;
console.debug('Push id: ' + id);
$http({
method: 'POST',
url: App.service + 'config',
data: {key: 'push-ios', value: service.id},
headers: {'Content-Type': 'application/x-www-form-urlencoded'}
});
complete();
},
function() {
console.error('Failed registering push notifications', arguments);
App.alert('Failed to enable Push notifications. Please go to your push notification settings on your device and enable them for Cockpit.');
complete();
},params
); );
}; };