Update: Adds a Bitcoin Core Wallet setting which hides BTC wallets when disabled

This commit is contained in:
Sam Cheng Hung 2018-03-27 11:30:34 +09:00
commit 780951eb2f
12 changed files with 108 additions and 9 deletions

View file

@ -1037,5 +1037,29 @@ angular.module('copayApp.services')
return cb(null, txps, n);
};
root.initBitcoinCoreDisplay = function() {
configService.checkIfConfigIsSet('displayBitcoinCore').then(function(result) {
if (!result) {
var walletsBtc = root.getWallets({coin: 'btc'});
var totalBtc = 0;
walletsBtc.forEach( (value, key, index) => {
totalBtc += parseFloat(value.cachedBalance);
});
var enableDisplayBitcoinCore = totalBtc > 0 ? true : false;
var opts = {
displayBitcoinCore: {
enabled: enableDisplayBitcoinCore
}
};
configService.set(opts, function(err) {
if (err) $log.debug(err);
});
}
});
};
return root;
});