remove events and refactor of push notifications functions
This commit is contained in:
parent
509047e2b0
commit
e19ece08c7
4 changed files with 25 additions and 35 deletions
|
|
@ -1,6 +1,6 @@
|
|||
'use strict';
|
||||
angular.module('copayApp.services')
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, isChromeApp, isCordova, gettext, gettextCatalog, nodeWebkit, bwsError, uxLanguage, bitcore) {
|
||||
.factory('profileService', function profileServiceFactory($rootScope, $location, $timeout, $filter, $log, lodash, storageService, bwcService, configService, notificationService, pushNotificationsService, isChromeApp, isCordova, gettext, gettextCatalog, nodeWebkit, bwsError, uxLanguage, bitcore) {
|
||||
|
||||
var root = {};
|
||||
|
||||
|
|
@ -310,7 +310,9 @@ angular.module('copayApp.services')
|
|||
var fc = root.focusedClient;
|
||||
var walletId = fc.credentials.walletId;
|
||||
|
||||
$rootScope.$emit('Local/UnsubscribeNotifications', walletId, function() {
|
||||
pushNotificationsService.unsubscribe(root.getClient(walletId), function(err) {
|
||||
if (err) $log.warn('Subscription error: ' + err.code);
|
||||
else $log.debug('Unsubscribed from push notifications service');
|
||||
|
||||
$log.debug('Deleting Wallet:', fc.credentials.walletName);
|
||||
|
||||
|
|
@ -407,8 +409,9 @@ angular.module('copayApp.services')
|
|||
handleImport(function() {
|
||||
root.setAndStoreFocus(walletId, function() {
|
||||
storageService.storeProfile(root.profile, function(err) {
|
||||
$rootScope.$emit('Local/ProfileCreated');
|
||||
if (config.pushNotifications.enabled)
|
||||
$rootScope.$emit('Local/SubscribeNotifications');
|
||||
pushNotificationsService.enableNotifications(root.walletClients);
|
||||
return cb(err, walletId);
|
||||
});
|
||||
});
|
||||
|
|
@ -636,7 +639,7 @@ angular.module('copayApp.services')
|
|||
root.unlockFC = function(cb) {
|
||||
var fc = root.focusedClient;
|
||||
|
||||
if (!fc.isPrivKeyEncrypted())
|
||||
if (!fc.isPrivKeyEncrypted())
|
||||
return cb();
|
||||
|
||||
$log.debug('Wallet is encrypted');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue