fix import wallet
This commit is contained in:
parent
3607056d64
commit
e5f4844ca5
4 changed files with 26 additions and 19 deletions
|
|
@ -22,7 +22,6 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
|
|
||||||
var updateStatus = function(status) {
|
var updateStatus = function(status) {
|
||||||
$scope.importStatus = status;
|
$scope.importStatus = status;
|
||||||
$scope.$digest();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -80,19 +79,20 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
$scope.importOpts.skipFields = skipFields;
|
$scope.importOpts.skipFields = skipFields;
|
||||||
|
|
||||||
|
|
||||||
if (backupFile) {
|
$timeout(function() {
|
||||||
reader.readAsBinaryString(backupFile);
|
if (backupFile) {
|
||||||
} else {
|
reader.readAsBinaryString(backupFile);
|
||||||
updateStatus('Importing wallet - Procesing backup...');
|
} else {
|
||||||
identityService.importWallet(encryptedObj, $scope.password, $scope.importOpts, function(err) {
|
updateStatus('Importing wallet - Procesing backup...');
|
||||||
if (err) {
|
identityService.importWallet(backupText, $scope.password, $scope.importOpts, function(err) {
|
||||||
$scope.loading = false;
|
if (err) {
|
||||||
$scope.error = 'Could not read wallet. Please check your password';
|
$scope.loading = false;
|
||||||
$rootScope.$digest();
|
$scope.error = 'Could not read wallet. Please check your password';
|
||||||
return;
|
$rootScope.$digest();
|
||||||
}
|
return;
|
||||||
copay.Compatibility.deleteOldWallet(backupOldWallet);
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}, 1);
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -50,8 +50,10 @@ angular.module('copayApp.controllers').controller('ImportProfileController',
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.import = function(form) {
|
$scope.import = function(form) {
|
||||||
|
$scope.loading = true;
|
||||||
|
|
||||||
if (form.$invalid) {
|
if (form.$invalid) {
|
||||||
|
$scope.loading = false;
|
||||||
$scope.error = 'Please enter the required fields';
|
$scope.error = 'Please enter the required fields';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
@ -60,11 +62,11 @@ angular.module('copayApp.controllers').controller('ImportProfileController',
|
||||||
var password = form.password.$modelValue;
|
var password = form.password.$modelValue;
|
||||||
|
|
||||||
if (!backupFile && !backupText) {
|
if (!backupFile && !backupText) {
|
||||||
|
$scope.loading = false;
|
||||||
$scope.error = 'Please, select your backup file';
|
$scope.error = 'Please, select your backup file';
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
$scope.loading = true;
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
if (backupFile) {
|
if (backupFile) {
|
||||||
reader.readAsBinaryString(backupFile);
|
reader.readAsBinaryString(backupFile);
|
||||||
|
|
|
||||||
|
|
@ -247,6 +247,7 @@ Compatibility.kdf = function(password) {
|
||||||
};
|
};
|
||||||
|
|
||||||
Compatibility.deleteOldWallet = function(walletObj) {
|
Compatibility.deleteOldWallet = function(walletObj) {
|
||||||
|
console.log('[Compatibility.js:249]',walletObj); //TODO
|
||||||
localStorage.removeItem('wallet::' + walletObj.id + '_' + walletObj.name);
|
localStorage.removeItem('wallet::' + walletObj.id + '_' + walletObj.name);
|
||||||
log.info('Old wallet ' + walletObj.name + ' deleted: ' + walletObj.id);
|
log.info('Old wallet ' + walletObj.name + ' deleted: ' + walletObj.id);
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -13,11 +13,15 @@
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<form name="importForm" ng-submit="import(importForm)" novalidate>
|
<form name="importForm" ng-submit="import(importForm)" novalidate>
|
||||||
<div class="text-warning size-12 m20b" ng-show="error">
|
<div class="box-notification" ng-show="error">
|
||||||
<i class="fi-x"></i> {{error|translate}}
|
<div class="box-icon error">
|
||||||
|
<i class="fi-x size-24"></i>
|
||||||
|
</div>
|
||||||
|
<span class="text-warning size-14">
|
||||||
|
{{error|translate}}
|
||||||
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<div ng-show="!is_iOS && !backupOldWallet">
|
<div ng-show="!is_iOS && !backupOldWallet">
|
||||||
<legend for="backupFile" class="m10b">
|
<legend for="backupFile" class="m10b">
|
||||||
<span translate>Choose backup file from your computer</span> <i class="fi-laptop"></i>
|
<span translate>Choose backup file from your computer</span> <i class="fi-laptop"></i>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue