Fix if push is not available

This commit is contained in:
Gustavo Maximiliano Cortez 2016-10-10 13:45:43 -03:00
commit cd0e5df447
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
3 changed files with 16 additions and 4 deletions

View file

@ -318,6 +318,8 @@ angular.module('copayApp.services')
var defaults = configService.getDefaults();
var push = pushNotificationsService.init(root.wallet);
if (!push) return;
push.on('notification', function(data) {
if (!data.additionalData.foreground) {
$log.debug('Push notification event: ', data.message);

View file

@ -11,7 +11,12 @@ angular.module('copayApp.services')
root.init = function(walletsClients) {
var defaults = configService.getDefaults();
var push = PushNotification.init(defaults.pushNotifications.config);
try {
var push = PushNotification.init(defaults.pushNotifications.config);
} catch(e) {
$log.error(e);
return;
};
push.on('registration', function(data) {
$log.debug('Starting push notification registration');