diff --git a/src/js/controllers/cashScan.js b/src/js/controllers/cashScan.js index bf0fbeb51..85fddf239 100644 --- a/src/js/controllers/cashScan.js +++ b/src/js/controllers/cashScan.js @@ -1,7 +1,7 @@ 'use strict'; 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 errors = bwcService.getErrors(); $scope.error = null; @@ -11,6 +11,16 @@ angular.module('copayApp.controllers').controller('cashScanController', 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() { $ionicHistory.nextViewOptions({ disableAnimate: true, @@ -29,11 +39,6 @@ angular.module('copayApp.controllers').controller('cashScanController', network: 'livenet' }); - if (lodash.isEmpty(walletsBTC)) { - goHome(); - return; - } - // Filter out already duplicated wallets var walletsBCH = profileService.getWallets({ coin: 'bch', @@ -48,50 +53,23 @@ angular.module('copayApp.controllers').controller('cashScanController', var availableWallets = []; var nonEligibleWallets = []; - function addToNonEligibleWallets(wallets) { - if (!wallets) return; - lodash.each(wallets, function(w) { + lodash.each(walletsBTC, function(w) { + if (w.credentials.derivationStrategy != 'BIP44') { + w.excludeReason = gettextCatalog.getString('Non BIP44 wallet'); nonEligibleWallets.push(w); - }); - }; - - // Filter out non BIP44 wallets - var nonBIP44Wallets = lodash.filter(walletsBTC, function(w) { - return w.credentials.derivationStrategy != 'BIP44'; + } else if (!w.canSign()) { + w.excludeReason = gettextCatalog.getString('Read only wallet'); + nonEligibleWallets.push(w); + } else if (w.needsBackup) { + w.excludeReason = gettextCatalog.getString('Backup needed'); + 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.nonEligibleWallets = nonEligibleWallets; var i = availableWallets.length; var j = 0; diff --git a/src/sass/views/cashScan.scss b/src/sass/views/cashScan.scss index 5ae76ef53..f13e1b390 100644 --- a/src/sass/views/cashScan.scss +++ b/src/sass/views/cashScan.scss @@ -36,4 +36,8 @@ right: 15px; padding-top: .5rem; } + + a { + cursor: pointer; + } } diff --git a/www/views/cashScan.html b/www/views/cashScan.html index 551e11a18..ccf2a4ae0 100644 --- a/www/views/cashScan.html +++ b/www/views/cashScan.html @@ -10,49 +10,34 @@
-
- No wallets eligible for Bitcoin Cash support +
+
+ No wallets eligible for Bitcoin Cash support +
{{error}}
-
- BTC wallets -
- -
- - - -
-
{{wallet.name || wallet.id}}
-
{{wallet.bchBalance || ('Checking...' | translate)}}
-
{{wallet.m}}-of-{{wallet.n}}
-
- -
- -
-
- -
-
- +
- Backup needed + BTC wallets
-
+
- + - {{wallet.name || wallet.id}} -
+
+
{{wallet.name || wallet.id}}
+
{{wallet.bchBalance || ('Checking...' | translate)}}
+
{{wallet.m}}-of-{{wallet.n}}
+
-
- Complete the backup process to use this option +
+ +
@@ -67,11 +52,13 @@ - {{wallet.name || wallet.id}} +
{{wallet.name || wallet.id}}
+
{{wallet.excludeReason}}
- 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 + 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 + recovery tool.