This commit is contained in:
Matias Alejo Garcia 2016-02-25 16:03:03 -03:00
commit af581286cd

View file

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