This commit is contained in:
Matias Alejo Garcia 2016-02-25 16:03:03 -03:00
parent a55585b742
commit af581286cd
1 changed files with 24 additions and 22 deletions

View File

@ -892,7 +892,9 @@ angular.module('copayApp.controllers').controller('indexController', function($r
getNewTxs([], 0, function(err, txs) {
if (err) return cb(err);
var newHistory = lodash.compact(txs.concat(confirmedTxs));
var newHistory = lodash.uniq(lodash.compact(txs.concat(confirmedTxs)), function(x) {
return x.txid;
});
var historyToSave = JSON.stringify(newHistory);
lodash.each(txs, function(tx) {
@ -934,7 +936,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
}, 100);
};
self.startSearch = function(){
self.startSearch = function() {
self.isSearching = true;
self.txHistorySearchResults = [];
self.result = [];
@ -942,13 +944,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
self.nextTxHistory = self.historyShowMoreLimit;
}
self.cancelSearch = function(){
self.cancelSearch = function() {
self.isSearching = false;
self.result = [];
self.setCompactTxHistory();
}
self.updateSearchInput = function(search){
self.updateSearchInput = function(search) {
self.search = search;
if (isCordova)
window.plugins.toast.hide();
@ -960,13 +962,13 @@ angular.module('copayApp.controllers').controller('indexController', function($r
function filter(search) {
self.result = [];
function computeSearchableString(tx){
function computeSearchableString(tx) {
var addrbook = '';
if(tx.addressTo && self.addressbook && self.addressbook[tx.addressTo]) addrbook = self.addressbook[tx.addressTo] || '';
if (tx.addressTo && self.addressbook && self.addressbook[tx.addressTo]) addrbook = self.addressbook[tx.addressTo] || '';
var searchableDate = computeSearchableDate(new Date(tx.time * 1000));
var message = tx.message ? tx.message : '';
var addressTo = tx.addressTo ? tx.addressTo : '';
return ((tx.amountStr+message+addressTo+addrbook+searchableDate).toString()).toLowerCase();
return ((tx.amountStr + message + addressTo + addrbook + searchableDate).toString()).toLowerCase();
}
function computeSearchableDate(date) {
@ -999,7 +1001,7 @@ angular.module('copayApp.controllers').controller('indexController', function($r
$rootScope.$apply();
});
},1000);
}, 1000);
self.getTxsFromServer = function(client, skip, endingTxid, limit, cb) {
var res = [];