list available and unavailable wallets properly
This commit is contained in:
parent
b997d6ff9c
commit
5867edfa26
2 changed files with 76 additions and 15 deletions
|
|
@ -45,19 +45,57 @@ angular.module('copayApp.controllers').controller('cashScanController',
|
|||
return !xPubKeyIndex[w.credentials.xPubKey];
|
||||
});
|
||||
|
||||
// Filter out non BIP44 wallets
|
||||
var wallets = lodash.filter(walletsBTC, function(w) {
|
||||
return w.credentials.derivationStrategy == 'BIP44'
|
||||
});
|
||||
var availableWallets = [];
|
||||
var nonEligibleWallets = [];
|
||||
|
||||
$scope.wallets = wallets;
|
||||
$scope.nonBIP44Wallets = lodash.filter(walletsBTC, function(w) {
|
||||
function addToNonEligibleWallets(wallets) {
|
||||
if (!wallets) return;
|
||||
lodash.each(wallets, function(w) {
|
||||
nonEligibleWallets.push(w);
|
||||
});
|
||||
};
|
||||
|
||||
// Filter out non BIP44 wallets
|
||||
var nonBIP44Wallets = lodash.filter(walletsBTC, function(w) {
|
||||
return w.credentials.derivationStrategy != 'BIP44';
|
||||
});
|
||||
|
||||
var i = wallets.length;
|
||||
if (!lodash.isEmpty(nonBIP44Wallets)) {
|
||||
availableWallets = lodash.filter(walletsBTC, function(w) {
|
||||
return w.credentials.derivationStrategy == 'BIP44';
|
||||
});
|
||||
addToNonEligibleWallets(nonBIP44Wallets);
|
||||
}
|
||||
|
||||
// Filter out read only wallets
|
||||
var readOnlyWallets = lodash.filter(availableWallets, function(w) {
|
||||
return !w.canSign();
|
||||
});
|
||||
|
||||
if (!lodash.isEmpty(readOnlyWallets)) {
|
||||
availableWallets = lodash.filter(availableWallets, function(w) {
|
||||
return w.canSign();
|
||||
});
|
||||
addToNonEligibleWallets(readOnlyWallets);
|
||||
}
|
||||
|
||||
// Filter out non backed up wallets
|
||||
$scope.nonBackedUpWallets = lodash.filter(availableWallets, function(w) {
|
||||
return w.needsBackup;
|
||||
});
|
||||
|
||||
if (!lodash.isEmpty($scope.nonBackedUpWallets)) {
|
||||
availableWallets = lodash.filter(availableWallets, function(w) {
|
||||
return !w.needsBackup;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.nonEligibleWallets = nonEligibleWallets;
|
||||
$scope.availableWallets = availableWallets;
|
||||
|
||||
var i = availableWallets.length;
|
||||
var j = 0;
|
||||
lodash.each(wallets, function(wallet) {
|
||||
lodash.each(availableWallets, function(wallet) {
|
||||
walletService.getBalance(wallet, {
|
||||
coin: 'bch'
|
||||
}, function(err, balance) {
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<ion-content>
|
||||
|
||||
<div class="list card">
|
||||
<div class="item" ng-if="(!wallets || !wallets[0]) && !nonBIP44Wallets[0]">
|
||||
<div class="item" ng-if="(!availableWallets || !availableWallets[0]) && !nonEligibleWallets[0]">
|
||||
<span class="assertive" translate>No wallets eligible for Bitcoin Cash support</span>
|
||||
</div>
|
||||
|
||||
|
|
@ -19,11 +19,13 @@
|
|||
</div>
|
||||
|
||||
<div class="item heading">
|
||||
<span translate>BTC Wallets</span>
|
||||
<span translate>BTC wallets</span>
|
||||
</div>
|
||||
|
||||
<div ng-repeat="wallet in wallets track by $index" class="item wallet supported">
|
||||
<i class="icon big-icon-svg" ng-include="'views/includes/walletIcon.html'"></i>
|
||||
<div ng-repeat="wallet in availableWallets track by $index" class="item wallet supported">
|
||||
<i class="icon big-icon-svg">
|
||||
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': wallet.color}" class="bg wallet"/>
|
||||
</i>
|
||||
<div class="wallet-content">
|
||||
<div>{{wallet.name || wallet.id}}</div>
|
||||
<div class="balanced">{{wallet.bchBalance || ('Checking...' | translate)}} </div>
|
||||
|
|
@ -35,20 +37,41 @@
|
|||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="nonBIP44Wallets[0]">
|
||||
<div ng-if="nonBackedUpWallets[0]">
|
||||
<div class="item item-divider"></div>
|
||||
|
||||
<div class="item heading">
|
||||
<span translate>Backup needed</span>
|
||||
</div>
|
||||
|
||||
<div ng-repeat="wallet in nonBackedUpWallets track by $index" class="item item-sub item-icon-left item-big-icon-left item-button-right wallet">
|
||||
<i class="icon big-icon-svg">
|
||||
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': walletDisabled}" class="bg wallet"/>
|
||||
</i>
|
||||
<span class="text-disabled">{{wallet.name || wallet.id}}</span>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="comment" translate>Complete the backup process to use this option</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div ng-if="nonEligibleWallets[0]">
|
||||
<div class="item item-divider"></div>
|
||||
|
||||
<div class="item heading">
|
||||
<span translate>Non eligible BTC wallets</span>
|
||||
</div>
|
||||
|
||||
<div ng-repeat="wallet in nonBIP44Wallets track by $index" class="item item-sub item-icon-left item-big-icon-left item-button-right wallet">
|
||||
<i class="icon big-icon-svg" ng-include="'views/includes/walletIcon.html'"></i>
|
||||
<div ng-repeat="wallet in nonEligibleWallets track by $index" class="item item-sub item-icon-left item-big-icon-left item-button-right wallet">
|
||||
<i class="icon big-icon-svg">
|
||||
<img ng-src="img/{{wallet.network == 'testnet' ? 'icon-wallet-testnet' : (wallet.coin == 'btc' ? 'icon-btc' : 'icon-bch')}}.svg" ng-class="{'wallet-background-color-default': !wallet.color}" ng-style="{'background-color': walletDisabled}" class="bg wallet"/>
|
||||
</i>
|
||||
<span class="text-disabled">{{wallet.name || wallet.id}}</span>
|
||||
</div>
|
||||
|
||||
<div class="item">
|
||||
<span class="comment" translate>Some of you wallets are not eligible for Bitcon Cash support because there where created before Copay v1.2. Please use our recovery tool to access your Bitcoin Cash balance for those wallets</span>
|
||||
<span class="comment" translate>Some of you wallets are not eligible for Bitcon Cash support because both there where created before Copay v1.2 or are not available to sign. Please use our recovery tool to access your Bitcoin Cash balance for those wallets</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue