From 580b8e64fa20a3af1cad6f3eade1d68e87dc2105 Mon Sep 17 00:00:00 2001 From: Matias Alejo Garcia Date: Fri, 17 Jun 2016 12:03:53 -0300 Subject: [PATCH] store profile if dirty after validation --- src/js/controllers/index.js | 2 ++ src/js/services/profileService.js | 3 +-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index a7a814f68..77dc106aa 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -1413,7 +1413,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r }); $rootScope.$on('Local/ValidatingWalletEnded', function(ev, walletId, isOK) { + profileService.storeProfileIfDirty(); if (self.isInFocus(walletId)) { + // NOTE: If the user changed the wallet, the flag is already turn off. ongoingProcess.set('validatingWallet', false); self.incorrectDerivation = isOK === false; } diff --git a/src/js/services/profileService.js b/src/js/services/profileService.js index 6268bd4cd..0327d71a3 100644 --- a/src/js/services/profileService.js +++ b/src/js/services/profileService.js @@ -132,14 +132,13 @@ angular.module('copayApp.services') skipDeviceValidation: skipDeviceValidation, }, function(err, isOK) { $log.debug('ValidatingWallet End: ' + walletId + ' isOK:' + isOK); - $rootScope.$emit('Local/ValidatingWalletEnded', walletId, isOK); - if (isOK) { root.profile.setChecked(platformInfo.ua, walletId); } else { $log.warn('Key Derivation failed for wallet:' + walletId); storageService.clearLastAddress(walletId, function() {}); } + $rootScope.$emit('Local/ValidatingWalletEnded', walletId, isOK); }); }, 5000); };