remove history cache from export
This commit is contained in:
parent
761964ea3a
commit
b433120121
4 changed files with 11 additions and 52 deletions
|
|
@ -1,10 +1,12 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('exportController',
|
||||
function($rootScope, $scope, $timeout, $log, backupService, fingerprintService, configService, storageService, profileService, platformInfo, notification, go, gettext, gettextCatalog) {
|
||||
function($scope, $timeout, $log, backupService, fingerprintService, configService, storageService, profileService, platformInfo, notification, go, gettext, gettextCatalog) {
|
||||
var isWP = platformInfo.isWP;
|
||||
var isAndroid = platformInfo.isAndroid;
|
||||
var isCordova = platformInfo.isCordova;
|
||||
|
||||
$scope.error = null;
|
||||
$scope.success = null;
|
||||
var fc = profileService.focusedClient;
|
||||
$scope.isEncrypted = fc.isPrivKeyEncrypted();
|
||||
$scope.touchidSuccess = null;
|
||||
|
|
@ -32,14 +34,13 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
};
|
||||
|
||||
$scope.downloadWalletBackup = function() {
|
||||
$scope.getMetaData($scope.metaDataEnabled, function(err, txsFromLocal, localAddressBook) {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
if (err) {
|
||||
$scope.error = true;
|
||||
return;
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.noSignEnabled,
|
||||
historyCache: txsFromLocal,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
|
|
@ -48,43 +49,12 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
$scope.error = true;
|
||||
return;
|
||||
}
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
notification.success(gettext('Success'), gettext('Encrypted export file saved'));
|
||||
go.walletHome();
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getMetaData = function(metaData, cb) {
|
||||
if (metaData == false) return cb();
|
||||
$scope.getHistoryCache(function(err, txsFromLocal) {
|
||||
if (err) return cb(err);
|
||||
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
if (err) return cb(err);
|
||||
|
||||
return cb(null, txsFromLocal, localAddressBook)
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getHistoryCache = function(cb) {
|
||||
storageService.getTxHistory(fc.credentials.walletId, function(err, txs) {
|
||||
if (err) return cb(err);
|
||||
|
||||
var localTxs = [];
|
||||
|
||||
try {
|
||||
localTxs = JSON.parse(txs);
|
||||
} catch (ex) {
|
||||
$log.warn(ex);
|
||||
}
|
||||
if (!localTxs[0]) return cb(null, null);
|
||||
|
||||
return cb(null, localTxs);
|
||||
});
|
||||
};
|
||||
|
||||
$scope.getAddressbook = function(cb) {
|
||||
storageService.getAddressbook(fc.credentials.network, function(err, addressBook) {
|
||||
if (err) return cb(err);
|
||||
|
|
@ -101,14 +71,13 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
};
|
||||
|
||||
$scope.getBackup = function(cb) {
|
||||
$scope.getMetaData($scope.metaDataEnabled, function(err, txsFromLocal, localAddressBook) {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
if (err) {
|
||||
$scope.error = true;
|
||||
return cb(null);
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.noSignEnabled,
|
||||
historyCache: txsFromLocal,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
|
|
@ -117,7 +86,6 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
$scope.error = true;
|
||||
} else {
|
||||
$scope.error = false;
|
||||
$rootScope.$emit('Local/BackupDone');
|
||||
}
|
||||
return cb(ew);
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue