Bug/select wallet incomplete / Refactor wallet Services (#4159)
* Addressbook: display error if select an incomplete wallet * Check if wallet is complete/needs_backup for Glidera and Coinbase * Ref/create a walletService * Ref. walletService * Fix Glidera and Coinbase * Removes txService * Fix glidera connection for mobile. Fix bitcode for xcode * Fix duplicated entry * Revert "Bump bwc version 2.3.1" * adds karma-mocha * Refactor * Refactor lock function * Refactor reject, remove and broadcast tx * add walletService tests WIP * add walletService tests WIP 2 * merge * update tests to mocha * fix tests. Angular 1.5? * Fix test * Generate angular-bwc before testing * Rever gitignore * Wording
This commit is contained in:
parent
aee30ec151
commit
98471e952a
27 changed files with 698 additions and 628 deletions
|
|
@ -1,13 +1,21 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('backupController',
|
||||
function($rootScope, $scope, $timeout, $log, $state, $compile, go, lodash, profileService, gettext, bwcService, bwsError) {
|
||||
function($rootScope, $scope, $timeout, $log, $state, $compile, go, lodash, profileService, gettext, bwcService, bwsError, walletService) {
|
||||
|
||||
var self = this;
|
||||
var fc = profileService.focusedClient;
|
||||
var customWords = [];
|
||||
self.walletName = fc.credentials.walletName;
|
||||
|
||||
var handleEncryptedWallet = function(client, cb) {
|
||||
if (!walletService.isEncrypted(client)) return cb();
|
||||
$rootScope.$emit('Local/NeedsPassword', false, function(err, password) {
|
||||
if (err) return cb(err);
|
||||
return cb(walletService.unlock(client, password));
|
||||
});
|
||||
};
|
||||
|
||||
function init() {
|
||||
$scope.passphrase = '';
|
||||
resetAllButtons();
|
||||
|
|
@ -46,7 +54,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
function initWords() {
|
||||
var words = fc.getMnemonic();
|
||||
self.xPrivKey = fc.credentials.xPrivKey;
|
||||
profileService.lockFC();
|
||||
walletService.lock(fc);
|
||||
self.mnemonicWords = words.split(/[\u3000\s]+/);
|
||||
self.shuffledMnemonicWords = lodash.sortBy(self.mnemonicWords);;
|
||||
self.mnemonicHasPassphrase = fc.mnemonicHasPassphrase();
|
||||
|
|
@ -74,7 +82,7 @@ angular.module('copayApp.controllers').controller('backupController',
|
|||
$scope.$apply();
|
||||
}, 1);
|
||||
|
||||
profileService.unlockFC({}, function(err) {
|
||||
handleEncryptedWallet(fc, function(err) {
|
||||
if (err) {
|
||||
self.error = bwsError.msg(err, gettext('Could not decrypt'));
|
||||
$log.warn('Error decrypting credentials:', self.error); //TODO
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue