mirror of https://github.com/BTCPrivate/copay.git
Add feedback while importing wallet
This commit is contained in:
parent
a5e7b54d19
commit
96cbf8ad7b
|
@ -276,7 +276,7 @@
|
|||
<div ng-controller="ImportController">
|
||||
<div data-alert class="alert-box info radius" ng-show="loading">
|
||||
<i class="size-21 fi-bitcoin-circle icon-rotate spinner"></i>
|
||||
Importing wallet...
|
||||
{{ importStatus }}
|
||||
</div>
|
||||
<div ng-init="choosefile=0; pastetext=0" ng-show="!loading">
|
||||
<h3>{{title}}</h3>
|
||||
|
|
|
@ -3,10 +3,19 @@
|
|||
angular.module('copayApp.controllers').controller('ImportController',
|
||||
function($scope, $rootScope, walletFactory, controllerUtils, Passphrase) {
|
||||
$scope.title = 'Import a backup';
|
||||
$scope.importStatus = 'Importing wallet - Reading backup...';
|
||||
|
||||
var reader = new FileReader();
|
||||
|
||||
var updateStatus = function(status) {
|
||||
$scope.importStatus = status;
|
||||
$scope.$digest();
|
||||
}
|
||||
|
||||
var _importBackup = function(encryptedObj) {
|
||||
Passphrase.getBase64Async($scope.password, function(passphrase) {
|
||||
walletFactory.import(encryptedObj, passphrase, function(err, w) {
|
||||
updateStatus('Importing wallet - Setting things up...');
|
||||
var w = walletFactory.import(encryptedObj, passphrase, function(err, w) {
|
||||
if (err) {
|
||||
$scope.loading = false;
|
||||
$rootScope.$flashMessage = {
|
||||
|
@ -19,6 +28,10 @@ angular.module('copayApp.controllers').controller('ImportController',
|
|||
$rootScope.wallet = w;
|
||||
controllerUtils.startNetwork($rootScope.wallet, $scope);
|
||||
});
|
||||
|
||||
w.on('updatingIndexes', function(){
|
||||
updateStatus('Importing wallet - We are almost there...');
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
|
|
|
@ -755,6 +755,7 @@ Wallet.prototype.updateIndexes = function(callback) {
|
|||
if (changeIndex != -1)
|
||||
self.publicKeyRing.indexes.changeIndex = changeIndex + 1;
|
||||
|
||||
self.emit('updatingIndexes');
|
||||
start = self.publicKeyRing.indexes.receiveIndex;
|
||||
self.indexDiscovery(start, false, 20, function(err, receiveIndex) {
|
||||
if (err) return callback(err);
|
||||
|
|
|
@ -84,6 +84,7 @@ WalletFactory.prototype.import = function(base64, password, cb) {
|
|||
self.log('Indexes updated');
|
||||
cb(null, w);
|
||||
});
|
||||
return w;
|
||||
}
|
||||
|
||||
WalletFactory.prototype.read = function(walletId) {
|
||||
|
|
|
@ -743,7 +743,7 @@ describe('Wallet model', function() {
|
|||
var spyEmit = sinon.spy(w, 'emit');
|
||||
w.updateIndexes(function(err) {
|
||||
sinon.assert.callCount(spyStore, 1);
|
||||
sinon.assert.callCount(spyEmit, 1);
|
||||
sinon.assert.callCount(spyEmit, 2);
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue