ref wallet filters - add recovery tool external link
This commit is contained in:
parent
5867edfa26
commit
dc5d24d010
3 changed files with 48 additions and 79 deletions
|
|
@ -1,7 +1,7 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('cashScanController',
|
angular.module('copayApp.controllers').controller('cashScanController',
|
||||||
function($rootScope, $timeout, $scope, $state, $stateParams, $ionicModal, $ionicScrollDelegate, $ionicHistory, $window, gettextCatalog, lodash, popupService, ongoingProcess, profileService, walletService, configService, $log, txFormatService, bwcError, pushNotificationsService, bwcService) {
|
function($rootScope, $timeout, $scope, $state, $ionicHistory, gettextCatalog, lodash, ongoingProcess, profileService, walletService, $log, txFormatService, bwcError, pushNotificationsService, bwcService, externalLinkService) {
|
||||||
var wallet;
|
var wallet;
|
||||||
var errors = bwcService.getErrors();
|
var errors = bwcService.getErrors();
|
||||||
$scope.error = null;
|
$scope.error = null;
|
||||||
|
|
@ -11,6 +11,16 @@ angular.module('copayApp.controllers').controller('cashScanController',
|
||||||
updateAllWallets();
|
updateAllWallets();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
$scope.openRecoveryToolLink = function() {
|
||||||
|
var url = 'https://bitpay.github.io/copay-recovery/';
|
||||||
|
var optIn = true;
|
||||||
|
var title = null;
|
||||||
|
var message = gettextCatalog.getString('Open the recovery tool.');
|
||||||
|
var okText = gettextCatalog.getString('Open');
|
||||||
|
var cancelText = gettextCatalog.getString('Go Back');
|
||||||
|
externalLinkService.open(url, optIn, title, message, okText, cancelText);
|
||||||
|
};
|
||||||
|
|
||||||
var goHome = function() {
|
var goHome = function() {
|
||||||
$ionicHistory.nextViewOptions({
|
$ionicHistory.nextViewOptions({
|
||||||
disableAnimate: true,
|
disableAnimate: true,
|
||||||
|
|
@ -29,11 +39,6 @@ angular.module('copayApp.controllers').controller('cashScanController',
|
||||||
network: 'livenet'
|
network: 'livenet'
|
||||||
});
|
});
|
||||||
|
|
||||||
if (lodash.isEmpty(walletsBTC)) {
|
|
||||||
goHome();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Filter out already duplicated wallets
|
// Filter out already duplicated wallets
|
||||||
var walletsBCH = profileService.getWallets({
|
var walletsBCH = profileService.getWallets({
|
||||||
coin: 'bch',
|
coin: 'bch',
|
||||||
|
|
@ -48,50 +53,23 @@ angular.module('copayApp.controllers').controller('cashScanController',
|
||||||
var availableWallets = [];
|
var availableWallets = [];
|
||||||
var nonEligibleWallets = [];
|
var nonEligibleWallets = [];
|
||||||
|
|
||||||
function addToNonEligibleWallets(wallets) {
|
lodash.each(walletsBTC, function(w) {
|
||||||
if (!wallets) return;
|
if (w.credentials.derivationStrategy != 'BIP44') {
|
||||||
lodash.each(wallets, function(w) {
|
w.excludeReason = gettextCatalog.getString('Non BIP44 wallet');
|
||||||
nonEligibleWallets.push(w);
|
nonEligibleWallets.push(w);
|
||||||
});
|
} else if (!w.canSign()) {
|
||||||
};
|
w.excludeReason = gettextCatalog.getString('Read only wallet');
|
||||||
|
nonEligibleWallets.push(w);
|
||||||
// Filter out non BIP44 wallets
|
} else if (w.needsBackup) {
|
||||||
var nonBIP44Wallets = lodash.filter(walletsBTC, function(w) {
|
w.excludeReason = gettextCatalog.getString('Backup needed');
|
||||||
return w.credentials.derivationStrategy != 'BIP44';
|
nonEligibleWallets.push(w);
|
||||||
|
} else {
|
||||||
|
availableWallets.push(w);
|
||||||
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
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;
|
$scope.availableWallets = availableWallets;
|
||||||
|
$scope.nonEligibleWallets = nonEligibleWallets;
|
||||||
|
|
||||||
var i = availableWallets.length;
|
var i = availableWallets.length;
|
||||||
var j = 0;
|
var j = 0;
|
||||||
|
|
|
||||||
|
|
@ -36,4 +36,8 @@
|
||||||
right: 15px;
|
right: 15px;
|
||||||
padding-top: .5rem;
|
padding-top: .5rem;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a {
|
||||||
|
cursor: pointer;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -10,49 +10,34 @@
|
||||||
<ion-content>
|
<ion-content>
|
||||||
|
|
||||||
<div class="list card">
|
<div class="list card">
|
||||||
<div class="item" ng-if="(!availableWallets || !availableWallets[0]) && !nonEligibleWallets[0]">
|
<div ng-if="!availableWallets[0]">
|
||||||
<span class="assertive" translate>No wallets eligible for Bitcoin Cash support</span>
|
<div class="item">
|
||||||
|
<span class="assertive" translate>No wallets eligible for Bitcoin Cash support</span>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item" ng-if="error">
|
<div class="item" ng-if="error">
|
||||||
<span class="assertive">{{error}}</span>
|
<span class="assertive">{{error}}</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item heading">
|
<div ng-if="availableWallets[0]">
|
||||||
<span translate>BTC wallets</span>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<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>
|
|
||||||
<div class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1" translate>{{wallet.m}}-of-{{wallet.n}}</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="duplicate-button">
|
|
||||||
<button ng-click="duplicate(wallet)" class="button button-small button-outline button-primary" translate>Duplicate for BCH</button>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div ng-if="nonBackedUpWallets[0]">
|
|
||||||
<div class="item item-divider"></div>
|
|
||||||
|
|
||||||
<div class="item heading">
|
<div class="item heading">
|
||||||
<span translate>Backup needed</span>
|
<span translate>BTC wallets</span>
|
||||||
</div>
|
</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">
|
<div ng-repeat="wallet in availableWallets track by $index" class="item wallet supported">
|
||||||
<i class="icon big-icon-svg">
|
<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"/>
|
<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>
|
</i>
|
||||||
<span class="text-disabled">{{wallet.name || wallet.id}}</span>
|
<div class="wallet-content">
|
||||||
</div>
|
<div>{{wallet.name || wallet.id}}</div>
|
||||||
|
<div class="balanced">{{wallet.bchBalance || ('Checking...' | translate)}} </div>
|
||||||
|
<div class="tab-home__wallet__multisig-number" ng-if="wallet.n > 1" translate>{{wallet.m}}-of-{{wallet.n}}</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="item">
|
<div class="duplicate-button">
|
||||||
<span class="comment" translate>Complete the backup process to use this option</span>
|
<button ng-click="duplicate(wallet)" class="button button-small button-outline button-primary" translate>Duplicate for BCH</button>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
@ -67,11 +52,13 @@
|
||||||
<i class="icon big-icon-svg">
|
<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"/>
|
<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>
|
</i>
|
||||||
<span class="text-disabled">{{wallet.name || wallet.id}}</span>
|
<div class="text-disabled">{{wallet.name || wallet.id}}</div>
|
||||||
|
<div class="text-disabled">{{wallet.excludeReason}}</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="item">
|
<div class="item">
|
||||||
<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>
|
<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. To access the funds from these wallets please use our</span>
|
||||||
|
<a ng-click="openRecoveryToolLink()" translate>recovery tool.</a>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue