Added needBackup flag when importing a wallet
This commit is contained in:
parent
52fb680658
commit
36822dce49
2 changed files with 71 additions and 54 deletions
|
|
@ -18,20 +18,21 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
$scope.$digest();
|
$scope.$digest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
$scope.getFile = function() {
|
$scope.getFile = function() {
|
||||||
// If we use onloadend, we need to check the readyState.
|
// If we use onloadend, we need to check the readyState.
|
||||||
reader.onloadend = function(evt) {
|
reader.onloadend = function(evt) {
|
||||||
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
|
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
|
||||||
var encryptedObj = evt.target.result;
|
var encryptedObj = evt.target.result;
|
||||||
updateStatus('Importing wallet - Procesing backup...');
|
updateStatus('Importing wallet - Procesing backup...');
|
||||||
identityService.importWallet(encryptedObj, $scope.password, {}, function(err){
|
identityService.importWallet(encryptedObj, $scope.password, {}, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.error = 'Could not read wallet. Please check your password';
|
$scope.error = 'Could not read wallet. Please check your password';
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.import = function(form) {
|
$scope.import = function(form) {
|
||||||
|
|
@ -72,11 +73,12 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
$scope.importOpts.skipFields = skipFields;
|
$scope.importOpts.skipFields = skipFields;
|
||||||
|
|
||||||
|
|
||||||
|
<< << << < HEAD
|
||||||
if (backupFile) {
|
if (backupFile) {
|
||||||
reader.readAsBinaryString(backupFile);
|
reader.readAsBinaryString(backupFile);
|
||||||
} else {
|
} else {
|
||||||
updateStatus('Importing wallet - Procesing backup...');
|
updateStatus('Importing wallet - Procesing backup...');
|
||||||
identityService.importWallet(encryptedObj, $scope.password, $scope.importOpts, function(err){
|
identityService.importWallet(encryptedObj, $scope.password, $scope.importOpts, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
$scope.error = 'Could not read wallet. Please check your password';
|
$scope.error = 'Could not read wallet. Please check your password';
|
||||||
|
|
@ -85,4 +87,12 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
});
|
}); === === =
|
||||||
|
if (backupFile) {
|
||||||
|
reader.readAsBinaryString(backupFile);
|
||||||
|
} else {
|
||||||
|
$scope._doImport(backupText, $scope.password);
|
||||||
|
copay.Compatibility.deleteOldWallet(backupOldWallet);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}); >>> >>> > Added needBackup flag when importing a wallet
|
||||||
|
|
|
||||||
|
|
@ -278,6 +278,13 @@ Identity.prototype.exportEncryptedWithWalletInfo = function(opts) {
|
||||||
return crypto.encrypt(this.password, this.exportWithWalletInfo(opts));
|
return crypto.encrypt(this.password, this.exportWithWalletInfo(opts));
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Identity.prototype.setBackupNeeded = function() {
|
||||||
|
this.backupNeeded = true;
|
||||||
|
this.store({
|
||||||
|
noWallets: true
|
||||||
|
}, function() {});
|
||||||
|
}
|
||||||
|
|
||||||
Identity.prototype.setBackupDone = function() {
|
Identity.prototype.setBackupDone = function() {
|
||||||
this.backupNeeded = false;
|
this.backupNeeded = false;
|
||||||
this.store({
|
this.store({
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue