From f225d3eac7a3ec9728f77b17fabbd64ff02bee3c Mon Sep 17 00:00:00 2001 From: Devin Smith Date: Mon, 23 Mar 2015 13:43:02 -0700 Subject: [PATCH] fixed some android push shit --- www/assets/cockpit/js/service.push.js | 51 +++++++++++++++------------ 1 file changed, 29 insertions(+), 22 deletions(-) diff --git a/www/assets/cockpit/js/service.push.js b/www/assets/cockpit/js/service.push.js index 06224d5d9..bbededfc2 100644 --- a/www/assets/cockpit/js/service.push.js +++ b/www/assets/cockpit/js/service.push.js @@ -17,27 +17,13 @@ NGApp.factory('PushService', function($http, MainNavigationService, DriverOrders }, false); service.register = function(complete) { - - 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(); - }, - { + if (device.platform == 'android' || device.platform == 'Android' || device.platform == 'amazon-fireos') { + var params = { + 'senderID': '1029345412368', + 'ecb': 'pushnotification' + }; + } else { + var params = { 'badge': 'true', 'sound': '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 ); };