Go back
diff --git a/js/controllers/import.js b/js/controllers/import.js
index c2328e0ae..c1e594114 100644
--- a/js/controllers/import.js
+++ b/js/controllers/import.js
@@ -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() {
// If we use onloadend, we need to check the readyState.
reader.onloadend = function(evt) {
@@ -48,7 +59,7 @@ angular.module('copay.import').controller('ImportController',
}
$scope.loading = true;
-
+
if (backupFile) {
reader.readAsBinaryString(backupFile);
}
diff --git a/js/shell.js b/js/shell.js
index fe5722015..4fde3b0fd 100644
--- a/js/shell.js
+++ b/js/shell.js
@@ -78,6 +78,15 @@
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
window.onerror = function(err) {
ipc.send('error', err);