Added needBackup flag when importing a wallet

This commit is contained in:
Matias Pando 2014-11-26 17:16:46 -03:00
commit 36822dce49
2 changed files with 71 additions and 54 deletions

View file

@ -18,6 +18,7 @@ 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) {
@ -31,7 +32,7 @@ angular.module('copayApp.controllers').controller('ImportController',
} }
}); });
} }
}; }
}; };
$scope.import = function(form) { $scope.import = function(form) {
@ -72,6 +73,7 @@ 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 {
@ -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

View file

@ -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({