mirror of https://github.com/BTCPrivate/copay.git
added handling of importing a backup
This commit is contained in:
parent
4dbad23eac
commit
11c1157f9e
|
@ -249,9 +249,9 @@
|
||||||
<div class="large-6 large-centered medium-6 medium-centered columns">
|
<div class="large-6 large-centered medium-6 medium-centered columns">
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend>Select which method want to use to restore</legend>
|
<legend>Select which method want to use to restore</legend>
|
||||||
<label for="backupFile" ng-click="choosefile=!choosefile" class="m10b">· Choose backup file from your computer <i class="fi-laptop"></i></label>
|
<label for="backupFile" ng-click="openFileDialog()" class="m10b">· Choose backup file from your computer <i class="fi-laptop"></i></label>
|
||||||
<input type="file" class="form-control" placeholder="Select a backup file" name="backupFile" ng-model="backupFile" ng-file-select ng-show="choosefile">
|
<input type="file" class="form-control" placeholder="Select a backup file" name="backupFile" ng-model="backupFile" ng-file-select ng-show="choosefile">
|
||||||
<label for="backupText" ng-click="pastetext=!pastetext" class="m10b">· Paste backup plain text code <i class="fi-clipboard"></i></label>
|
<label for="backupText" ng-click="openPasteArea()" class="m10b">· Paste backup plain text code <i class="fi-clipboard"></i></label>
|
||||||
<textarea class="form-control" name="backupText" ng-model="backupText" rows="5" ng-show="pastetext"></textarea>
|
<textarea class="form-control" name="backupText" ng-model="backupText" rows="5" ng-show="pastetext"></textarea>
|
||||||
</fieldset>
|
</fieldset>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -19,6 +19,17 @@ angular.module('copay.import').controller('ImportController',
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.openFileDialog = function() {
|
||||||
|
if (window.cshell) {
|
||||||
|
return cshell.send('backup:import');
|
||||||
|
}
|
||||||
|
$scope.choosefile = !$scope.choosefile;
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.openPasteArea = function() {
|
||||||
|
$scope.pastetext = !$scope.pastetext;
|
||||||
|
};
|
||||||
|
|
||||||
$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) {
|
||||||
|
|
|
@ -78,6 +78,15 @@
|
||||||
ctrl.email();
|
ctrl.email();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
ipc.on('backup:import', function(data) {
|
||||||
|
location.href = '#/import';
|
||||||
|
var ctrl = controller('ImportController');
|
||||||
|
if (!ctrl) return;
|
||||||
|
ctrl.backupText = data;
|
||||||
|
ctrl.openPasteArea();
|
||||||
|
ctrl.$apply();
|
||||||
|
});
|
||||||
|
|
||||||
// let the shell know when an error occurs
|
// let the shell know when an error occurs
|
||||||
window.onerror = function(err) {
|
window.onerror = function(err) {
|
||||||
ipc.send('error', err);
|
ipc.send('error', err);
|
||||||
|
|
Loading…
Reference in New Issue