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:
Gustavo Maximiliano Cortez 2016-05-09 15:56:44 -03:00
commit 98471e952a
No known key found for this signature in database
GPG key ID: 15EDAD8D9F2EB1AF
27 changed files with 698 additions and 628 deletions

View file

@ -1,7 +1,7 @@
'use strict';
angular.module('copayApp.controllers').controller('buyCoinbaseController',
function($scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, txService, bwsError, addressService) {
function($scope, $modal, $log, $timeout, lodash, profileService, coinbaseService, animationService, bwsError, addressService, walletService) {
window.ignoreMobilePause = true;
var self = this;
@ -71,17 +71,17 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
};
$scope.selectWallet = function(walletId, walletName) {
if (!profileService.getClient(walletId).isComplete()) {
self.error = bwsError.msg({
'code': 'WALLET_NOT_COMPLETE'
}, 'Could not choose the wallet');
self.error = {errors: [{ message: 'The Wallet could not be selected' }]};
$modalInstance.dismiss('cancel');
return;
}
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
var client = profileService.getClient(walletId);
walletService.isReady(client, function(err) {
if (err) {
self.error = {errors: [{ message: err }]};
$modalInstance.dismiss('cancel');
} else {
$modalInstance.close({
'walletId': walletId,
'walletName': walletName,
});
}
});
};
};