add push notification registration event

This commit is contained in:
Gabriel Bazán 2016-01-26 15:10:39 -03:00
commit 426d8d29b0
2 changed files with 9 additions and 3 deletions

View file

@ -16,7 +16,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
if (self.usePushNotifications) {
storageService.getDeviceToken(function(err, token) {
$timeout(function() {
if (!token) pushNotificationsService.pushNotificationsInit(profileService.walletClients);
if (!token) pushNotificationsService.pushNotificationsInit();
}, 5000);
});
}
@ -1293,6 +1293,12 @@ angular.module('copayApp.controllers').controller('indexController', function($r
});
});
$rootScope.$on('Local/pushNotificationsRegistration', function(event) {
var config = configService.getSync();
if (self.usePushNotifications && config.pushNotifications.enabled)
pushNotificationsService.enableNotifications(profileService.walletClients);
});
self.debouncedUpdate = lodash.throttle(function() {
self.updateAll({
quiet: true