From 9b3e8363a0154f36ff2b7d011010c604ea594476 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 18 Apr 2015 07:08:08 -0300 Subject: [PATCH 1/2] fix addr at recreat --- src/js/controllers/index.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 9118b415c..18f76418e 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -134,8 +134,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r $timeout(function() { self.setOngoingProcess('updatingPendingTxps', true); $log.debug('Updating PendingTxps'); - fc.getTxProposals({ - }, function(err, txps) { + fc.getTxProposals({}, function(err, txps) { self.setOngoingProcess('updatingPendingTxps', false); if (err) { $log.debug('Wallet PendingTxps ERROR:', err); @@ -362,9 +361,11 @@ angular.module('copayApp.controllers').controller('indexController', function($r } profileService.setWalletClients(); - $timeout(function() { - $rootScope.$emit('Local/WalletImported', self.walletId); - }, 100); + storageService.clearLastAddress(self.walletId, function(err, addr) { + $timeout(function() { + $rootScope.$emit('Local/WalletImported', self.walletId); + }, 100); + }); }); }; From 563b318db6f548778d5e43b49fb23be187c536bb Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Sat, 18 Apr 2015 07:23:11 -0300 Subject: [PATCH 2/2] clear error after recreate --- src/js/controllers/import.js | 1 + src/js/controllers/index.js | 15 ++++++++------- src/js/services/profileService.js | 1 - 3 files changed, 9 insertions(+), 8 deletions(-) diff --git a/src/js/controllers/import.js b/src/js/controllers/import.js index 9b7caacc9..90ca4d072 100644 --- a/src/js/controllers/import.js +++ b/src/js/controllers/import.js @@ -38,6 +38,7 @@ angular.module('copayApp.controllers').controller('importController', self.error = err; } else { + $rootScope.$emit('Local/WalletImported', walletId); go.walletHome(); notification.success('Success', 'Your wallet has been imported correctly'); } diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index 18f76418e..6692006f4 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -338,7 +338,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r if (used) { $log.debug('Address ' + addr + ' was used. Cleaning Cache.') $rootScope.$emit('Local/NeedNewAddress', err); - storageService.clearLastAddress(self.walletId, function(err, addr) { + storageService.clearLastAddress(self.walletId, function(err) { if (cb) return cb(); }); }; @@ -350,6 +350,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.recreate = function(cb) { var fc = profileService.focusedClient; self.setOngoingProcess('recreating', true); + self.clientError = null; fc.recreateWallet(function(err) { self.notAuthorized = false; self.setOngoingProcess('recreating', false); @@ -361,11 +362,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r } profileService.setWalletClients(); - storageService.clearLastAddress(self.walletId, function(err, addr) { - $timeout(function() { - $rootScope.$emit('Local/WalletImported', self.walletId); - }, 100); - }); + $timeout(function() { + $rootScope.$emit('Local/WalletImported', self.walletId); + }, 100); }); }; @@ -460,7 +459,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/WalletImported', function(event, walletId) { - self.startScan(walletId); + storageService.clearLastAddress(walletId, function(err) { + self.startScan(walletId); + }); }); $rootScope.$on('Animation/Disable', function(event) { diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 00924533c..420bce8b5 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -253,7 +253,6 @@ angular.module('copayApp.services') root.setAndStoreFocus(walletId, function() { storageService.storeProfile(root.profile, function(err) { - $rootScope.$emit('Local/WalletImported', walletId); return cb(null, walletId); }); });