delete response in unsubscribe method

This commit is contained in:
Gabriel Bazán 2016-01-20 16:25:06 -03:00
commit 6be5209fcf
2 changed files with 11 additions and 16 deletions

View file

@ -13,8 +13,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.prevState = 'walletHome';
document.addEventListener('deviceready', function() {
if (!self.usePushNotifications) return;
storageService.getDeviceToken(function(err, token) {
$timeout(function() {
if (!token) pushNotificationsService.pushNotificationsInit();
@ -1286,18 +1284,17 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
$rootScope.$on('Local/SubscribeNotifications', function(event) {
if (!self.usePushNotifications) return;
pushNotificationsService.enableNotifications();
});
$rootScope.$on('Local/UnsubscribeNotifications', function(event, walletId, cb) {
if (self.usePushNotifications) return cb();
if (!self.usePushNotifications) return cb();
pushNotificationsService.unsubscribe(walletId, function(err, response) {
if (err) $log.warn('Error: ' + err.code);
$log.debug('Unsubscribed: ' + response);
pushNotificationsService.unsubscribe(walletId, function(err) {
if (err) $log.warn('Subscription error: ' + err.code);
else $log.debug('Unsubscribed from push notifications service');
return cb();
});
});