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());
});
if (search && (search.indexOf('bitcoincash:') >= 0 || search[0] === 'C' || search[0] === 'H' || search[0] === 'p' || search[0] === 'q') && search.replace('bitcoincash:', '').length === 42) {
$scope.searchTermIsAddress = true;
} else if (search && search.lengh === 64) {
$scope.searchTermIsTxId = true;
if (search) {
if ((search.indexOf('bitcoincash:') >= 0 || search[0] === 'C' || search[0] === 'H' || search[0] === 'p' || search[0] === 'q') && search.replace('bitcoincash:', '').length === 42) { // CashAddr
$scope.searchTermIsAddress = 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;
@ -87,7 +91,7 @@ angular.module('copayApp.controllers').controller('searchController', function($
};
$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 title = null;
var message = gettextCatalog.getString('Search on Explorer.Bitcoin.com');

View file

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