Merge pull request #197 from colkito/feature/import-backups
Feature/import backups
This commit is contained in:
commit
d08d0aa875
6 changed files with 73 additions and 13 deletions
22
js/controllers/import.js
Normal file
22
js/controllers/import.js
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copay.import').controller('ImportController',
|
||||
function($scope, $rootScope, walletFactory, controllerUtils) {
|
||||
$scope.title = 'Import a backup';
|
||||
|
||||
$scope.getFile = function() {
|
||||
var reader = new FileReader();
|
||||
|
||||
// If we use onloadend, we need to check the readyState.
|
||||
reader.onloadend = function(evt) {
|
||||
if (evt.target.readyState == FileReader.DONE) { // DONE == 2
|
||||
var obj = JSON.parse(evt.target.result);
|
||||
$rootScope.wallet = walletFactory.fromObj(obj);
|
||||
|
||||
controllerUtils.startNetwork($rootScope.wallet);
|
||||
}
|
||||
};
|
||||
|
||||
reader.readAsBinaryString($scope.file);
|
||||
};
|
||||
});
|
||||
Loading…
Add table
Add a link
Reference in a new issue