complete export process
This commit is contained in:
parent
39ca6ec656
commit
dd9e48df14
6 changed files with 145 additions and 170 deletions
|
|
@ -1,13 +1,22 @@
|
||||||
<ion-view>
|
<ion-view>
|
||||||
<ion-tabs class="tabs-striped tabs-color-positive tabs-color-active-positive tabs-top">
|
<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-content ng-controller="exportController" ng-init="file = true; init();">
|
||||||
<ion-nav-view name="tab-export-file"></ion-nav-view>
|
<div class="row text-center">
|
||||||
</ion-tab>
|
<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">
|
<div ng-include="'views/tab-export-file.html'" ng-if="file"></div>
|
||||||
<ion-nav-view name="tab-export-qrCode"></ion-nav-view>
|
<div ng-include="'views/tab-export-qrCode.html'" ng-if="!file"></div>
|
||||||
</ion-tab>
|
</ion-content>
|
||||||
|
|
||||||
</ion-tabs>
|
|
||||||
</ion-view>
|
</ion-view>
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@
|
||||||
<span translate>Sweep paper wallet</span>
|
<span translate>Sweep paper wallet</span>
|
||||||
<i class="icon nav-item-arrow-right"></i>
|
<i class="icon nav-item-arrow-right"></i>
|
||||||
</a>
|
</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>
|
<span translate>Export Wallet</span>
|
||||||
<i class="icon nav-item-arrow-right"></i>
|
<i class="icon nav-item-arrow-right"></i>
|
||||||
</a>
|
</a>
|
||||||
|
|
|
||||||
|
|
@ -1,15 +1,3 @@
|
||||||
<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">
|
<div class="size-14" ng-show="error">
|
||||||
<i class="ion-alert-circled"></i>
|
<i class="ion-alert-circled"></i>
|
||||||
|
|
@ -17,26 +5,31 @@
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<form name="exportForm" novalidate>
|
<form name="exportForm" novalidate>
|
||||||
|
<div class="card">
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
<span class="input-label" transalate>Set up a password</span>
|
<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>
|
||||||
|
|
||||||
<label class="item item-input item-stacked-label">
|
<label class="item item-input item-stacked-label">
|
||||||
<span class="input-label" transalate>Repeat the password</span>
|
<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>
|
</label>
|
||||||
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
<ion-toggle ng-show="canSign" ng-model="showAdvanced" toggle-class="toggle-balanced">
|
<ion-toggle ng-show="canSign" ng-model="formData.showAdvanced" toggle-class="toggle-balanced">
|
||||||
<span translate ng-show="!showAdvanced">Show advanced options</span>
|
<span translate ng-show="!formData.showAdvanced">Show advanced options</span>
|
||||||
<span translate ng-show="showAdvanced">Hide advanced options</span>
|
<span translate ng-show="formData.showAdvanced">Hide advanced options</span>
|
||||||
</ion-toggle>
|
</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>
|
<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">
|
<span class="size-14">
|
||||||
<i class="ion-alert-circled"></i>
|
<i class="ion-alert-circled"></i>
|
||||||
<span translate>
|
<span translate>
|
||||||
|
|
@ -45,7 +38,7 @@
|
||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="box-notification" ng-show="noSignEnabled">
|
<div class="box-notification error" ng-show="formData.noSignEnabled">
|
||||||
<span class="size-14">
|
<span class="size-14">
|
||||||
<i class="ion-alert-circled"></i>
|
<i class="ion-alert-circled"></i>
|
||||||
<span translate>
|
<span translate>
|
||||||
|
|
@ -57,7 +50,7 @@
|
||||||
<button
|
<button
|
||||||
ng-click="downloadWalletBackup()"
|
ng-click="downloadWalletBackup()"
|
||||||
class="button button-block button-positive"
|
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-style="{'background-color':wallet.color}"
|
||||||
ng-show="!isSafari && !isCordova">
|
ng-show="!isSafari && !isCordova">
|
||||||
<i class="fi-download"></i>
|
<i class="fi-download"></i>
|
||||||
|
|
@ -67,38 +60,34 @@
|
||||||
<button
|
<button
|
||||||
ng-click="viewWalletBackup()"
|
ng-click="viewWalletBackup()"
|
||||||
class="button button-block button-positive"
|
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-style="{'background-color':wallet.color}"
|
||||||
ng-show="isSafari && !isCordova">
|
ng-show="isSafari && !isCordova">
|
||||||
<i class="fi-eye"></i>
|
<i class="fi-eye"></i>
|
||||||
<span translate>View</span>
|
<span translate>View</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<div ng-show="isCordova">
|
<div ng-show="isCordova">
|
||||||
<h4 translate>Export options</h4>
|
<h4 translate>Export options</h4>
|
||||||
<button class="button button-block button-positive"
|
<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-style="{'background-color':wallet.color}"
|
||||||
ng-click="copyWalletBackup()">
|
ng-click="copyWalletBackup()">
|
||||||
<i class="fi-clipboard-pencil"></i>
|
<i class="fi-clipboard-pencil"></i>
|
||||||
<span translate>Copy to clipboard</span></button>
|
<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-style="{'background-color':wallet.color}"
|
||||||
ng-click="sendWalletBackup()"><i class="fi-mail"></i>
|
ng-click="sendWalletBackup()"><i class="fi-mail"></i>
|
||||||
<span translate>Send by email</span></button>
|
<span translate>Send by email</span></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row" ng-show="backupWalletPlainText">
|
<div ng-show="backupWalletPlainText" class="text-center card">
|
||||||
<div class="large-12 columns">
|
<label class="item item-input item-stacked-label">
|
||||||
<h3 translate>Wallet Export</h3>
|
|
||||||
<div class="input">
|
|
||||||
<textarea rows="12">{{backupWalletPlainText}}</textarea>
|
<textarea rows="12">{{backupWalletPlainText}}</textarea>
|
||||||
</div>
|
</label>
|
||||||
<div class="size-12 text-gray text-right">
|
<div class="item text-gray item-icon-left">
|
||||||
<i class="icon-compose"></i>
|
<i class="icon ion-compose"></i>
|
||||||
<span translate>Copy this text as it is to a safe place (notepad or email)</span>
|
<p translate>Copy this text as it is to a safe place (notepad or email)</p>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
</ion-content>
|
|
||||||
</ion-view>
|
|
||||||
|
|
|
||||||
|
|
@ -1,25 +1,10 @@
|
||||||
<ion-view>
|
<div class="m20t text-gray" ng-show="formData.supported">
|
||||||
<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="text-center m20b">
|
<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>
|
||||||
<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 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 class="text-center size-12 m10" translate>Exporting via QR not supported for this wallet</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
</ion-content>
|
|
||||||
</ion-view>
|
|
||||||
|
|
|
||||||
|
|
@ -5,16 +5,14 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
var prevState;
|
var prevState;
|
||||||
var isWP = platformInfo.isWP;
|
var isWP = platformInfo.isWP;
|
||||||
var isAndroid = platformInfo.isAndroid;
|
var isAndroid = platformInfo.isAndroid;
|
||||||
|
|
||||||
var wallet = profileService.getWallet($stateParams.walletId);
|
var wallet = profileService.getWallet($stateParams.walletId);
|
||||||
|
|
||||||
|
$scope.init = function() {
|
||||||
|
$scope.formData = {};
|
||||||
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
|
$scope.isEncrypted = wallet.isPrivKeyEncrypted();
|
||||||
$scope.isCordova = platformInfo.isCordova;
|
$scope.isCordova = platformInfo.isCordova;
|
||||||
$scope.isSafari = platformInfo.isSafari;
|
$scope.isSafari = platformInfo.isSafari;
|
||||||
|
$scope.formData.noSignEnabled = false;
|
||||||
$scope.init = function() {
|
|
||||||
$scope.supported = true;
|
|
||||||
$scope.exportQR = false;
|
|
||||||
$scope.noSignEnabled = false;
|
|
||||||
$scope.showAdvanced = false;
|
$scope.showAdvanced = false;
|
||||||
$scope.wallet = wallet;
|
$scope.wallet = wallet;
|
||||||
$scope.canSign = wallet.canSign();
|
$scope.canSign = wallet.canSign();
|
||||||
|
|
@ -22,13 +20,15 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
walletService.getEncodedWalletInfo(wallet, function(err, code) {
|
walletService.getEncodedWalletInfo(wallet, function(err, code) {
|
||||||
if (err || !code) {
|
if (err || !code) {
|
||||||
$log.warn(err);
|
$log.warn(err);
|
||||||
return $state.go('wallet.preferencesAdvanced')
|
return $ionicHistory.goBack();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!code)
|
if (!code)
|
||||||
$scope.supported = false;
|
$scope.formData.supported = false;
|
||||||
else
|
else {
|
||||||
$scope.exportWalletInfo = code;
|
$scope.formData.supported = true;
|
||||||
|
$scope.formData.exportWalletInfo = code;
|
||||||
|
}
|
||||||
|
|
||||||
$timeout(function() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
|
|
@ -38,14 +38,25 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
|
|
||||||
/*
|
/*
|
||||||
EXPORT WITHOUT PRIVATE KEY - PENDING
|
EXPORT WITHOUT PRIVATE KEY - PENDING
|
||||||
|
*/
|
||||||
|
|
||||||
$scope.noSignEnabledChange = function() {
|
$scope.noSignEnabledChange = function() {
|
||||||
$scope.exportWalletInfo = encodeWalletInfo();
|
if (!$scope.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() {
|
$timeout(function() {
|
||||||
$scope.$apply();
|
$scope.$apply();
|
||||||
}, 1);
|
}, 1);
|
||||||
|
});
|
||||||
};
|
};
|
||||||
*/
|
|
||||||
|
|
||||||
$scope.downloadWalletBackup = function() {
|
$scope.downloadWalletBackup = function() {
|
||||||
$scope.getAddressbook(function(err, localAddressBook) {
|
$scope.getAddressbook(function(err, localAddressBook) {
|
||||||
|
|
@ -54,11 +65,11 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
var opts = {
|
var opts = {
|
||||||
noSign: $scope.noSignEnabled,
|
noSign: $scope.formData.noSignEnabled,
|
||||||
addressBook: localAddressBook
|
addressBook: localAddressBook
|
||||||
};
|
};
|
||||||
|
|
||||||
backupService.walletDownload($scope.password, opts, function(err) {
|
backupService.walletDownload($scope.formData.password, opts, function(err) {
|
||||||
if (err) {
|
if (err) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||||
return;
|
return;
|
||||||
|
|
@ -91,11 +102,11 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
return cb(null);
|
return cb(null);
|
||||||
}
|
}
|
||||||
var opts = {
|
var opts = {
|
||||||
noSign: $scope.noSignEnabled,
|
noSign: $scope.formData.noSignEnabled,
|
||||||
addressBook: localAddressBook
|
addressBook: localAddressBook
|
||||||
};
|
};
|
||||||
|
|
||||||
var ew = backupService.walletExport($scope.password, opts);
|
var ew = backupService.walletExport($scope.formData.password, opts);
|
||||||
if (!ew) {
|
if (!ew) {
|
||||||
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
popupService.showAlert(gettextCatalog.getString('Error'), gettextCatalog.getString('Failed to export'));
|
||||||
}
|
}
|
||||||
|
|
@ -132,7 +143,7 @@ angular.module('copayApp.controllers').controller('exportController',
|
||||||
var ew = backup;
|
var ew = backup;
|
||||||
if (!ew) return;
|
if (!ew) return;
|
||||||
|
|
||||||
if ($scope.noSignEnabled)
|
if ($scope.formData.noSignEnabled)
|
||||||
name = name + '(No Private Key)';
|
name = name + '(No Private Key)';
|
||||||
|
|
||||||
var subject = 'Copay Wallet Backup: ' + name;
|
var subject = 'Copay Wallet Backup: ' + name;
|
||||||
|
|
|
||||||
|
|
@ -459,7 +459,6 @@ angular.module('copayApp').config(function(historicLogProvider, $provide, $logPr
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.state('tabs.preferences.export', {
|
.state('tabs.preferences.export', {
|
||||||
abstract: true,
|
|
||||||
url: '/export',
|
url: '/export',
|
||||||
views: {
|
views: {
|
||||||
'preferences': {
|
'preferences': {
|
||||||
|
|
@ -467,24 +466,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', {
|
.state('tabs.preferences.preferencesBwsUrl', {
|
||||||
url: '/preferencesBwsUrl',
|
url: '/preferencesBwsUrl',
|
||||||
views: {
|
views: {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue