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,7 +1,7 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('buyGlideraController',
|
||||
function($scope, $timeout, $modal, profileService, addressService, glideraService, bwsError, lodash, isChromeApp, animationService) {
|
||||
function($scope, $timeout, $modal, profileService, addressService, glideraService, bwsError, lodash, isChromeApp, animationService, walletService) {
|
||||
|
||||
var self = this;
|
||||
this.show2faCodeInput = null;
|
||||
|
|
@ -50,14 +50,17 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
};
|
||||
|
||||
$scope.selectWallet = function(walletId, walletName) {
|
||||
if (!profileService.getClient(walletId).isComplete()) {
|
||||
self.error = bwsError.msg({'code': 'WALLET_NOT_COMPLETE'}, 'Could not choose the wallet');
|
||||
$modalInstance.dismiss('cancel');
|
||||
return;
|
||||
}
|
||||
$modalInstance.close({
|
||||
'walletId': walletId,
|
||||
'walletName': walletName,
|
||||
var client = profileService.getClient(walletId);
|
||||
walletService.isReady(client, function(err) {
|
||||
if (err) {
|
||||
self.error = err;
|
||||
$modalInstance.dismiss('cancel');
|
||||
return;
|
||||
}
|
||||
$modalInstance.close({
|
||||
'walletId': walletId,
|
||||
'walletName': walletName,
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
|
@ -94,26 +97,24 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
self.gettingBuyPrice = false;
|
||||
if (err) {
|
||||
self.error = 'Could not get exchange information. Please, try again.';
|
||||
return;
|
||||
}
|
||||
else {
|
||||
self.buyPrice = buyPrice;
|
||||
}
|
||||
self.buyPrice = buyPrice;
|
||||
});
|
||||
};
|
||||
|
||||
this.get2faCode = function(token) {
|
||||
var self = this;
|
||||
this.loading = 'Sending 2FA code...';
|
||||
self.error = null;
|
||||
self.loading = 'Sending 2FA code...';
|
||||
$timeout(function() {
|
||||
glideraService.get2faCode(token, function(err, sent) {
|
||||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = 'Could not send confirmation code to your phone';
|
||||
return;
|
||||
}
|
||||
else {
|
||||
self.error = null;
|
||||
self.show2faCodeInput = sent;
|
||||
}
|
||||
self.show2faCodeInput = sent;
|
||||
});
|
||||
}, 100);
|
||||
};
|
||||
|
|
@ -139,11 +140,10 @@ angular.module('copayApp.controllers').controller('buyGlideraController',
|
|||
self.loading = null;
|
||||
if (err) {
|
||||
self.error = err;
|
||||
return;
|
||||
}
|
||||
else {
|
||||
self.success = data;
|
||||
$scope.$emit('Local/GlideraTx');
|
||||
}
|
||||
self.success = data;
|
||||
$scope.$emit('Local/GlideraTx');
|
||||
});
|
||||
});
|
||||
}, 100);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue