Import backup from a plain text only for iOS
This commit is contained in:
parent
2e70b50943
commit
e19185139e
3 changed files with 25 additions and 9 deletions
|
|
@ -167,6 +167,7 @@ a:hover {
|
||||||
.join input,
|
.join input,
|
||||||
.setup input,
|
.setup input,
|
||||||
.import input,
|
.import input,
|
||||||
|
.import textarea,
|
||||||
.settings input {
|
.settings input {
|
||||||
background: #2C3E50 !important;
|
background: #2C3E50 !important;
|
||||||
-moz-box-shadow: inset 0px 0px 3px 0px rgba(0,0,0,0.10) !important;
|
-moz-box-shadow: inset 0px 0px 3px 0px rgba(0,0,0,0.10) !important;
|
||||||
|
|
|
||||||
|
|
@ -1,12 +1,13 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
angular.module('copayApp.controllers').controller('ImportController',
|
angular.module('copayApp.controllers').controller('ImportController',
|
||||||
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase, notification) {
|
function($scope, $rootScope, $location, walletFactory, controllerUtils, Passphrase, notification, isMobile) {
|
||||||
controllerUtils.redirIfLogged();
|
controllerUtils.redirIfLogged();
|
||||||
|
|
||||||
$scope.title = 'Import a backup';
|
$scope.title = 'Import a backup';
|
||||||
$scope.importStatus = 'Importing wallet - Reading backup...';
|
$scope.importStatus = 'Importing wallet - Reading backup...';
|
||||||
$scope.hideAdv = true;
|
$scope.hideAdv = true;
|
||||||
|
$scope.is_iOS = isMobile.iOS();
|
||||||
|
|
||||||
var reader = new FileReader();
|
var reader = new FileReader();
|
||||||
|
|
||||||
|
|
@ -69,10 +70,6 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
$scope.choosefile = !$scope.choosefile;
|
$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) {
|
||||||
|
|
@ -93,9 +90,10 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
}
|
}
|
||||||
|
|
||||||
var backupFile = $scope.file;
|
var backupFile = $scope.file;
|
||||||
|
var backupText = form.backupText.$modelValue;
|
||||||
var password = form.password.$modelValue;
|
var password = form.password.$modelValue;
|
||||||
|
|
||||||
if (!backupFile) {
|
if (!backupFile && !backupText) {
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
notification.error('Error', 'Please, select your backup file');
|
notification.error('Error', 'Please, select your backup file');
|
||||||
$scope.loading = false;
|
$scope.loading = false;
|
||||||
|
|
@ -105,5 +103,8 @@ angular.module('copayApp.controllers').controller('ImportController',
|
||||||
if (backupFile) {
|
if (backupFile) {
|
||||||
reader.readAsBinaryString(backupFile);
|
reader.readAsBinaryString(backupFile);
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
_importBackup(backupText);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -15,9 +15,23 @@
|
||||||
<h1 class="text-white line-sidebar-b">{{title|translate}}</h1>
|
<h1 class="text-white line-sidebar-b">{{title|translate}}</h1>
|
||||||
<form name="importForm" ng-submit="import(importForm)" novalidate>
|
<form name="importForm" ng-submit="import(importForm)" novalidate>
|
||||||
<fieldset>
|
<fieldset>
|
||||||
<legend for="backupFile" class="m10b"> <span translate>Choose backup file from your computer</span> <i class="fi-laptop"></i></legend>
|
<div ng-show="!is_iOS">
|
||||||
<input type="file" class="form-control"
|
<legend for="backupFile" class="m10b">
|
||||||
placeholder="{{'Select a backup file'|translate}}" name="backupFile" ng-model="backupFile" ng-file-select>
|
<span translate>Choose backup file from your computer</span> <i class="fi-laptop"></i>
|
||||||
|
</legend>
|
||||||
|
<input type="file" class="form-control"
|
||||||
|
placeholder="{{'Select a backup file'|translate}}" name="backupFile" ng-model="backupFile" ng-file-select>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="is_iOS">
|
||||||
|
<label for="backupText" class="m10b">
|
||||||
|
<span translate>Paste backup plain text code</span> <i class="fi-clipboard"></i>
|
||||||
|
</label>
|
||||||
|
<textarea class="form-control"
|
||||||
|
name="backupText"
|
||||||
|
ng-model="backupText"
|
||||||
|
rows="5"></textarea>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
|
||||||
<label for="password"><span translate>Password</span> <small translate>Required</small></label>
|
<label for="password"><span translate>Password</span> <small translate>Required</small></label>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue