commit
a735a3d0eb
6 changed files with 146 additions and 174 deletions
|
|
@ -1,13 +1,22 @@
|
|||
<ion-view >
|
||||
<ion-tabs class="tabs-striped tabs-color-positive tabs-color-active-positive tabs-top">
|
||||
<ion-view>
|
||||
<ion-nav-bar class="bar-royal">
|
||||
<ion-nav-title>{{'Export wallet' | translate}}</ion-nav-title>
|
||||
<ion-nav-back-button>
|
||||
<i class="icon ion-ios-arrow-thin-left"></i>
|
||||
</ion-nav-back-button>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-tab title="File/Text" ui-sref="tabs.preferences.export.file">
|
||||
<ion-nav-view name="tab-export-file"></ion-nav-view>
|
||||
</ion-tab>
|
||||
<ion-content ng-controller="exportController" ng-init="file = true; init();">
|
||||
<div class="row text-center">
|
||||
<div class="col" ng-click="file = true" ng-style="file && {'border-bottom': '2px solid'}">
|
||||
<span class="" translate>File/Text</span>
|
||||
</div>
|
||||
<div class="col" ng-click="file = false" ng-style="!file && {'border-bottom': '2px solid'}">
|
||||
<span class="" translate>QR Code</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<ion-tab title="QR Code" ui-sref="tabs.preferences.export.qrCode">
|
||||
<ion-nav-view name="tab-export-qrCode"></ion-nav-view>
|
||||
</ion-tab>
|
||||
|
||||
</ion-tabs>
|
||||
<div ng-include="'views/tab-export-file.html'" ng-if="file"></div>
|
||||
<div ng-include="'views/tab-export-qrCode.html'" ng-if="!file"></div>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@
|
|||
<span translate>Sweep paper wallet</span>
|
||||
<i class="icon nav-item-arrow-right"></i>
|
||||
</a>
|
||||
<a class="item item-icon-right" ui-sref="tabs.preferences.export.file">
|
||||
<a class="item item-icon-right" ui-sref="tabs.preferences.export">
|
||||
<span translate>Export Wallet</span>
|
||||
<i class="icon nav-item-arrow-right"></i>
|
||||
</a>
|
||||
|
|
|
|||
|
|
@ -1,42 +1,35 @@
|
|||
<ion-view>
|
||||
<ion-nav-bar class="bar-royal">
|
||||
<ion-nav-title>{{'Export Wallet' | translate}}</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button back-button" ui-sref="tabs.preferences.preferencesAdvanced">
|
||||
<i class="icon ion-ios-arrow-thin-left"></i>
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content ng-controller="exportController" ng-init="init()" cache-view="true">
|
||||
|
||||
<div ng-show="!backupWalletPlainText">
|
||||
<div ng-show="!backupWalletPlainText">
|
||||
<div class="size-14" ng-show="error">
|
||||
<i class="ion-alert-circled"></i>
|
||||
<span translate>Failed to export</span>
|
||||
</div>
|
||||
|
||||
<form name="exportForm" novalidate>
|
||||
<div class="card">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" transalate>Set up a password</span>
|
||||
<input type="password" placeholder="{{'Your password'|translate}}" name="password" ng-model="password">
|
||||
<input type="password" placeholder="{{'Your password'|translate}}" ng-model="formData.password">
|
||||
</label>
|
||||
|
||||
<label class="item item-input item-stacked-label">
|
||||
<span class="input-label" transalate>Repeat the password</span>
|
||||
<input type="password" class="form-control" placeholder="{{'Repeat password'|translate}}" name="password" ng-model="repeatpassword">
|
||||
<input type="password" placeholder="{{'Repeat password'|translate}}" ng-model="formData.repeatpassword">
|
||||
</label>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<ion-toggle ng-show="canSign" ng-model="showAdvanced" toggle-class="toggle-balanced">
|
||||
<span translate ng-show="!showAdvanced">Show advanced options</span>
|
||||
<span translate ng-show="showAdvanced">Hide advanced options</span>
|
||||
<ion-toggle ng-show="canSign" ng-model="formData.showAdvanced" toggle-class="toggle-balanced">
|
||||
<span translate ng-show="!formData.showAdvanced">Show advanced options</span>
|
||||
<span translate ng-show="formData.showAdvanced">Hide advanced options</span>
|
||||
</ion-toggle>
|
||||
|
||||
<ion-toggle ng-model="noSignEnabled" ng-show="showAdvanced" toggle-class="toggle-balanced" class="r0" ng-change="noSignEnabledChange()">
|
||||
<div class="card" ng-show="formData.showAdvanced">
|
||||
<ion-checkbox ng-model="formData.noSignEnabled" class="checkbox-balanced" ng-change="noSignEnabledChange()">
|
||||
<span class="toggle-label" translate>Do not include private key</span>
|
||||
</ion-toggle>
|
||||
</ion-checkbox>
|
||||
</div>
|
||||
|
||||
<div class="box-notification" ng-show="!canSign">
|
||||
<div class="box-notification error" ng-show="!canSign">
|
||||
<span class="size-14">
|
||||
<i class="ion-alert-circled"></i>
|
||||
<span translate>
|
||||
|
|
@ -45,7 +38,7 @@
|
|||
</span>
|
||||
</div>
|
||||
|
||||
<div class="box-notification" ng-show="noSignEnabled">
|
||||
<div class="box-notification error" ng-show="formData.noSignEnabled">
|
||||
<span class="size-14">
|
||||
<i class="ion-alert-circled"></i>
|
||||
<span translate>
|
||||
|
|
@ -57,7 +50,7 @@
|
|||
<button
|
||||
ng-click="downloadWalletBackup()"
|
||||
class="button button-block button-positive"
|
||||
ng-disabled="(!password || password != repeatpassword)"
|
||||
ng-disabled="(!formData.password || formData.password != formData.repeatpassword)"
|
||||
ng-style="{'background-color':wallet.color}"
|
||||
ng-show="!isSafari && !isCordova">
|
||||
<i class="fi-download"></i>
|
||||
|
|
@ -67,38 +60,34 @@
|
|||
<button
|
||||
ng-click="viewWalletBackup()"
|
||||
class="button button-block button-positive"
|
||||
ng-disabled="(!password || password != repeatpassword)"
|
||||
ng-disabled="(!formData.password || formData.password != formData.repeatpassword)"
|
||||
ng-style="{'background-color':wallet.color}"
|
||||
ng-show="isSafari && !isCordova">
|
||||
<i class="fi-eye"></i>
|
||||
<span translate>View</span>
|
||||
</button>
|
||||
|
||||
<div ng-show="isCordova">
|
||||
<h4 translate>Export options</h4>
|
||||
<button class="button button-block button-positive"
|
||||
ng-disabled="(!password || password != repeatpassword)"
|
||||
ng-disabled="(!formData.password || formData.password != formData.repeatpassword)"
|
||||
ng-style="{'background-color':wallet.color}"
|
||||
ng-click="copyWalletBackup()">
|
||||
<i class="fi-clipboard-pencil"></i>
|
||||
<span translate>Copy to clipboard</span></button>
|
||||
<button class="button button-block button-positive" ng-disabled="(!password || password != repeatpassword)"
|
||||
<button class="button button-block button-positive" ng-disabled="(!formData.password || formData.password != formData.repeatpassword)"
|
||||
ng-style="{'background-color':wallet.color}"
|
||||
ng-click="sendWalletBackup()"><i class="fi-mail"></i>
|
||||
<span translate>Send by email</span></button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="backupWalletPlainText">
|
||||
<div class="large-12 columns">
|
||||
<h3 translate>Wallet Export</h3>
|
||||
<div class="input">
|
||||
<div ng-show="backupWalletPlainText" class="text-center card">
|
||||
<label class="item item-input item-stacked-label">
|
||||
<textarea rows="12">{{backupWalletPlainText}}</textarea>
|
||||
</label>
|
||||
<div class="item text-gray item-icon-left">
|
||||
<i class="icon ion-compose"></i>
|
||||
<p translate>Copy this text as it is to a safe place (notepad or email)</p>
|
||||
</div>
|
||||
<div class="size-12 text-gray text-right">
|
||||
<i class="icon-compose"></i>
|
||||
<span translate>Copy this text as it is to a safe place (notepad or email)</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
</div>
|
||||
|
|
@ -1,25 +1,10 @@
|
|||
<ion-view>
|
||||
<ion-nav-bar class="bar-royal">
|
||||
<ion-nav-title>{{'Export Wallet' | translate}}</ion-nav-title>
|
||||
<ion-nav-buttons side="primary">
|
||||
<button class="button back-button" ui-sref="tabs.preferences.preferencesAdvanced">
|
||||
<i class="icon ion-ios-arrow-thin-left"></i>
|
||||
</button>
|
||||
</ion-nav-buttons>
|
||||
</ion-nav-bar>
|
||||
|
||||
<ion-content ng-controller="exportController" ng-init="init()">
|
||||
|
||||
<div class="m20t text-gray" ng-show="supported">
|
||||
<div class="m20t text-gray" ng-show="formData.supported">
|
||||
<div class="text-center m20b">
|
||||
<qrcode size="220" version="8" error-correction-level="M" data="{{exportWalletInfo}}"></qrcode>
|
||||
<qrcode size="220" version="8" error-correction-level="M" data="{{formData.exportWalletInfo}}"></qrcode>
|
||||
</div>
|
||||
<div class="text-center size-12 m10" translate>From the destination device, go to Add wallet > Import wallet and scan this QR code</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="m20t text-gray" ng-show="!supported">
|
||||
<div class="m20t text-gray" ng-show="!formData.supported">
|
||||
<div class="text-center size-12 m10" translate>Exporting via QR not supported for this wallet</div>
|
||||
</div>
|
||||
|
||||
</ion-content>
|
||||
</ion-view>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -1,20 +1,15 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('exportController',
|
||||
function($rootScope, $scope, $timeout, $log, $ionicHistory, lodash, backupService, walletService, storageService, profileService, platformInfo, gettext, gettextCatalog, $state, $stateParams, popupService) {
|
||||
var prevState;
|
||||
var isWP = platformInfo.isWP;
|
||||
var isAndroid = platformInfo.isAndroid;
|
||||
|
||||
function($scope, $timeout, $log, $ionicHistory, backupService, walletService, storageService, profileService, platformInfo, gettextCatalog, $state, $stateParams, popupService) {
|
||||
var wallet = profileService.getWallet($stateParams.walletId);
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.formData = {};
|
||||
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
|
||||
$scope.isCordova = platformInfo.isCordova;
|
||||
$scope.isSafari = platformInfo.isSafari;
|
||||
|
||||
$scope.init = function() {
|
||||
$scope.supported = true;
|
||||
$scope.exportQR = false;
|
||||
$scope.noSignEnabled = false;
|
||||
$scope.formData.noSignEnabled = false;
|
||||
$scope.showAdvanced = false;
|
||||
$scope.wallet = wallet;
|
||||
$scope.canSign = wallet.canSign();
|
||||
|
|
@ -22,13 +17,15 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
walletService.getEncodedWalletInfo(wallet, function(err, code) {
|
||||
if (err || !code) {
|
||||
$log.warn(err);
|
||||
return $state.go('wallet.preferencesAdvanced')
|
||||
return $ionicHistory.goBack();
|
||||
}
|
||||
|
||||
if (!code)
|
||||
$scope.supported = false;
|
||||
else
|
||||
$scope.exportWalletInfo = code;
|
||||
$scope.formData.supported = false;
|
||||
else {
|
||||
$scope.formData.supported = true;
|
||||
$scope.formData.exportWalletInfo = code;
|
||||
}
|
||||
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
|
|
@ -38,14 +35,25 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
|
||||
/*
|
||||
EXPORT WITHOUT PRIVATE KEY - PENDING
|
||||
*/
|
||||
|
||||
$scope.noSignEnabledChange = function() {
|
||||
$scope.exportWalletInfo = encodeWalletInfo();
|
||||
if (!$scope.formData.supported) return;
|
||||
|
||||
walletService.getEncodedWalletInfo(wallet, function(err, code) {
|
||||
if (err) {
|
||||
$log.error(err);
|
||||
$scope.formData.supported = false;
|
||||
$scope.formData.exportWalletInfo = null;
|
||||
} else {
|
||||
$scope.formData.supported = true;
|
||||
$scope.formData.exportWalletInfo = code;
|
||||
}
|
||||
$timeout(function() {
|
||||
$scope.$apply();
|
||||
}, 1);
|
||||
});
|
||||
};
|
||||
*/
|
||||
|
||||
$scope.downloadWalletBackup = function() {
|
||||
$scope.getAddressbook(function(err, localAddressBook) {
|
||||
|
|
@ -54,11 +62,11 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
return;
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.noSignEnabled,
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
backupService.walletDownload($scope.password, opts, function(err) {
|
||||
backupService.walletDownload($scope.formData.password, opts, function(err) {
|
||||
if (err) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
return;
|
||||
|
|
@ -91,11 +99,11 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
return cb(null);
|
||||
}
|
||||
var opts = {
|
||||
noSign: $scope.noSignEnabled,
|
||||
noSign: $scope.formData.noSignEnabled,
|
||||
addressBook: localAddressBook
|
||||
};
|
||||
|
||||
var ew = backupService.walletExport($scope.password, opts);
|
||||
var ew = backupService.walletExport($scope.formData.password, opts);
|
||||
if (!ew) {
|
||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||
}
|
||||
|
|
@ -132,7 +140,7 @@ angular.module('copayApp.controllers').controller('exportController',
|
|||
var ew = backup;
|
||||
if (!ew) return;
|
||||
|
||||
if ($scope.noSignEnabled)
|
||||
if ($scope.formData.noSignEnabled)
|
||||
name = name + '(No Private Key)';
|
||||
|
||||
var subject = 'Copay Wallet Backup: ' + name;
|
||||
|
|
|
|||
|
|
@ -434,7 +434,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
})
|
||||
.state('tabs.preferences.export', {
|
||||
abstract: true,
|
||||
url: '/export',
|
||||
views: {
|
||||
'preferences': {
|
||||
|
|
@ -442,24 +441,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
|||
}
|
||||
}
|
||||
})
|
||||
.state('tabs.preferences.export.file', {
|
||||
url: '/tab-export-file',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'tab-export-file': {
|
||||
templateUrl: 'views/tab-export-file.html',
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('tabs.preferences.export.qrCode', {
|
||||
url: '/tab-export-qrCode',
|
||||
needProfile: true,
|
||||
views: {
|
||||
'tab-export-qrCode': {
|
||||
templateUrl: 'views/tab-export-qrCode.html',
|
||||
},
|
||||
}
|
||||
})
|
||||
.state('tabs.preferences.preferencesBwsUrl', {
|
||||
url: '/preferencesBwsUrl',
|
||||
views: {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue