refactor wallet seletors in buy/sell controllers
This commit is contained in:
parent
27e925b84f
commit
4b0abd77a2
9 changed files with 73 additions and 119 deletions
|
|
@ -5,31 +5,17 @@ angular.module('copayApp.controllers').controller('buyCoinbaseController',
|
|||
var self = this;
|
||||
var fc;
|
||||
|
||||
var otherWallets = function(testnet) {
|
||||
var network = testnet ? 'testnet' : 'livenet';
|
||||
return lodash.filter(profileService.getWallets(network), function(w) {
|
||||
return w.network == network;
|
||||
});
|
||||
};
|
||||
|
||||
this.init = function(testnet) {
|
||||
self.otherWallets = otherWallets(testnet);
|
||||
// Choose focused wallet
|
||||
try {
|
||||
var currentWalletId = profileService.focusedClient.credentials.walletId;
|
||||
lodash.find(self.otherWallets, function(w) {
|
||||
if (w.id == currentWalletId) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = w.id;
|
||||
self.selectedWalletName = w.name;
|
||||
fc = profileService.getClient(w.id);
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
});
|
||||
} catch (e) {
|
||||
$log.debug(e);
|
||||
};
|
||||
self.allWallets = profileService.getWallets(testnet ? 'testnet' : 'livenet', 1)
|
||||
|
||||
client = profileService.focusedClient;
|
||||
if (client) {
|
||||
$timeout(function() {
|
||||
self.selectedWalletId = client.credentials.walletId;
|
||||
self.selectedWalletName = client.credentials.walletName;
|
||||
$scope.$apply();
|
||||
}, 100);
|
||||
}
|
||||
};
|
||||
|
||||
this.getPaymentMethods = function(token) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue