From 564d29e923dc0d9e958af220f9cb7d6282096145 Mon Sep 17 00:00:00 2001 From: Kadir Sekha Date: Fri, 2 Feb 2018 11:59:35 -0400 Subject: [PATCH] Revert "fixed brackets" This reverts commit 2227705453fc92dbc6b9a174381a461a30568180. --- src/js/services/profileService.js | 48 ++++++++++++++++--------------- 1 file changed, 25 insertions(+), 23 deletions(-) diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 17de69124..e239769cf 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -570,48 +570,50 @@ angular.module('copayApp.services') // Adds and bind a new client to the profile var addAndBindWalletClient = function(client, opts, cb) { if (!client || !client.credentials) - return cb(gettextCatalog.getString('Could not access wallet')); + return cb(gettextCatalog.getString('Could not access wallet')); // Encrypt wallet ongoingProcess.pause(); encryptWallet(client, function() { - ongoingProcess.resume(); + ongoingProcess.resume(); - var walletId = client.credentials.walletId + var walletId = client.credentials.walletId - if (!root.profile.addWallet(JSON.parse(client.export()))) + if (!root.profile.addWallet(JSON.parse(client.export()))) return cb(gettextCatalog.getString("Wallet already in {{appName}}", { appName: appConfigService.nameCase })); - var skipKeyValidation = shouldSkipValidation(walletId); - if (!skipKeyValidation) + var skipKeyValidation = shouldSkipValidation(walletId); + if (!skipKeyValidation) root.runValidation(client); - root.bindWalletClient(client); + root.bindWalletClient(client); - var saveBwsUrl = function(cb) { - var defaults = configService.getDefaults(); - var bwsFor = {}; - bwsFor[walletId] = opts.bwsurl || defaults.bws.url; + var saveBwsUrl = function(cb) { + var defaults = configService.getDefaults(); + var bwsFor = {}; + bwsFor[walletId] = opts.bwsurl || defaults.bws.url; - // Dont save the default - if (bwsFor[walletId] == defaults.bws.url) + // Dont save the default + if (bwsFor[walletId] == defaults.bws.url) return cb(); - configService.set({ - bwsFor: bwsFor, - }, function(err) { - if (err) $log.warn(err); - return cb(); - }); - }; + configService.set({ + bwsFor: bwsFor, + }, function(err) { + if (err) $log.warn(err); + return cb(); + }); + }; - saveBwsUrl(function() { - storageService.storeProfile(root.profile, function(err) { + saveBwsUrl(function() { + storageService.storeProfile(root.profile, function(err) { + if (cb) { return cb(err, client); - }); + } + return; }); }); };