Improvement - 322 - "Search transactions" empty results case

This commit is contained in:
Sebastiaan Pasma 2018-05-16 12:11:41 +02:00 committed by Sebastiaan Pasma
commit a915570df3
2 changed files with 14 additions and 18 deletions

View file

@ -52,10 +52,14 @@ angular.module('copayApp.controllers').controller('searchController', function($
return lodash.includes(tx.searcheableString, search.toLowerCase()); return lodash.includes(tx.searcheableString, search.toLowerCase());
}); });
if (search && (search.indexOf('bitcoincash:') >= 0 || search[0] === 'C' || search[0] === 'H' || search[0] === 'p' || search[0] === 'q') && search.replace('bitcoincash:', '').length === 42) { if (search) {
$scope.searchTermIsAddress = true; if ((search.indexOf('bitcoincash:') >= 0 || search[0] === 'C' || search[0] === 'H' || search[0] === 'p' || search[0] === 'q') && search.replace('bitcoincash:', '').length === 42) { // CashAddr
} else if (search && search.lengh === 64) { $scope.searchTermIsAddress = true;
$scope.searchTermIsTxId = true; } else if ((search[0] === "1" || search[0] === "3" || search.substring(0, 3) === "bc1") && search.length >= 26 && search.length <= 35) { // Legacy Addresses
$scope.searchTermIsAddress = true;
} else if (search.lengh === 64) {
$scope.searchTermIsTxId = true;
}
} }
if ($scope.filteredTxHistory.length > HISTORY_SHOW_LIMIT) $scope.txHistoryShowMore = true; if ($scope.filteredTxHistory.length > HISTORY_SHOW_LIMIT) $scope.txHistoryShowMore = true;
@ -87,7 +91,7 @@ angular.module('copayApp.controllers').controller('searchController', function($
}; };
$scope.searchOnBlockchain = function(searchTerm) { $scope.searchOnBlockchain = function(searchTerm) {
var url = 'https://explorer.bitcoin.com/bch/search/' + searchTerm; var url = 'https://explorer.bitcoin.com/'+$scope.wallet.coin+'/search/' + searchTerm;
var optIn = true; var optIn = true;
var title = null; var title = null;
var message = gettextCatalog.getString('Search on Explorer.Bitcoin.com'); var message = gettextCatalog.getString('Search on Explorer.Bitcoin.com');

View file

@ -4,7 +4,7 @@
Close Close
</button> </button>
<div class="title" translate> <div class="title" translate>
Search Transactions Search Transactions ({{wallet.coin}})
</div> </div>
</ion-header-bar> </ion-header-bar>
@ -23,18 +23,10 @@
{{'No results found'|translate}} {{'No results found'|translate}}
</div> </div>
<div class="p10t text-center"> <div class="p10t text-center">
<button ng-if="searchTermIsAddress" class="button button-small button-primary" ng-click="searchOnBlockchain(search)" translate> <button class="button button-small button-primary" ng-click="searchOnBlockchain(search)" translate>
{{'Show Address on Blockchain'|translate}} <span ng-if="searchTermIsTxId">{{'Show Transaction on Blockchain'|translate}}</span>
</button> <span ng-if="searchTermIsAddress">{{'Show Address on Blockchain'|translate}}</span>
</div> <span ng-if="!searchTermIsAddress && !searchTermIsTxId">{{'Search on Blockchain'|translate}}</span>
<div class="p10t text-center">
<button ng-if="searchTermIsTxId" class="button button-small button-primary" ng-click="searchOnBlockchain(search)" translate>
{{'Show Transaction on Blockchain'|translate}}
</button>
</div>
<div class="p10t text-center">
<button ng-if="!searchTermIsAddress && !searchTermIsTxId" class="button button-small button-primary" ng-click="searchOnBlockchain(search)" translate>
{{'Search on Blockchain'|translate}}
</button> </button>
</div> </div>
</div> </div>