Import backup from a plain text only for iOS

This commit is contained in:
Gustavo Maximiliano Cortez 2014-10-07 16:37:22 -03:00
parent 2e70b50943
commit e19185139e
3 changed files with 25 additions and 9 deletions

View File

@ -167,6 +167,7 @@ a:hover {
.join input,
.setup input,
.import input,
.import textarea,
.settings input {
background: #2C3E50 !important;
-moz-box-shadow: inset 0px 0px 3px 0px rgba(0,0,0,0.10) !important;

View File

@ -1,12 +1,13 @@
'use strict';
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();
$scope.title = 'Import a backup';
$scope.importStatus = 'Importing wallet - Reading backup...';
$scope.hideAdv = true;
$scope.is_iOS = isMobile.iOS();
var reader = new FileReader();
@ -69,10 +70,6 @@ angular.module('copayApp.controllers').controller('ImportController',
$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) {
@ -93,9 +90,10 @@ angular.module('copayApp.controllers').controller('ImportController',
}
var backupFile = $scope.file;
var backupText = form.backupText.$modelValue;
var password = form.password.$modelValue;
if (!backupFile) {
if (!backupFile && !backupText) {
$scope.loading = false;
notification.error('Error', 'Please, select your backup file');
$scope.loading = false;
@ -105,5 +103,8 @@ angular.module('copayApp.controllers').controller('ImportController',
if (backupFile) {
reader.readAsBinaryString(backupFile);
}
else {
_importBackup(backupText);
}
};
});

View File

@ -15,9 +15,23 @@
<h1 class="text-white line-sidebar-b">{{title|translate}}</h1>
<form name="importForm" ng-submit="import(importForm)" novalidate>
<fieldset>
<legend for="backupFile" class="m10b"> <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 ng-show="!is_iOS">
<legend for="backupFile" class="m10b">
<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>