Profile backup: copy to clipboard or send by email
This commit is contained in:
parent
53a7278123
commit
b2ddca4569
4 changed files with 62 additions and 26 deletions
|
|
@ -158,12 +158,11 @@ angular.module('copayApp.controllers').controller('MoreController',
|
||||||
window.plugins.toast.showShortCenter('Preparing backup...');
|
window.plugins.toast.showShortCenter('Preparing backup...');
|
||||||
var name = (w.name || w.id);
|
var name = (w.name || w.id);
|
||||||
var ew = backupService.walletEncrypted(w);
|
var ew = backupService.walletEncrypted(w);
|
||||||
var filename = name + '-keybackup.json.aes';
|
|
||||||
var properties = {
|
var properties = {
|
||||||
subject: 'Copay Wallet Backup: ' + name,
|
subject: 'Copay Wallet Backup: ' + name,
|
||||||
body: 'Here is the encrypted backup of the wallet '
|
body: 'Here is the encrypted backup of the wallet '
|
||||||
+ name + ': \n\n' + ew
|
+ name + ': \n\n' + ew
|
||||||
+ '\n\n To import this backup, copy all text between {...}, inclusive the symbols {}',
|
+ '\n\n To import this backup, copy all text between {...}, including the symbols {}',
|
||||||
isHtml: false
|
isHtml: false
|
||||||
};
|
};
|
||||||
window.plugin.email.open(properties);
|
window.plugin.email.open(properties);
|
||||||
|
|
|
||||||
|
|
@ -12,10 +12,31 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.viewProfileBackup = function() {
|
$scope.viewProfileBackup = function() {
|
||||||
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
|
$scope.loading = true;
|
||||||
$scope.hideViewProfileBackup = true;
|
$timeout(function() {
|
||||||
|
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
|
||||||
|
}, 100);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
$scope.copyProfileBackup = function() {
|
||||||
|
var ep = backupService.profileEncrypted($rootScope.iden);
|
||||||
|
window.cordova.plugins.clipboard.copy(ep);
|
||||||
|
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||||
|
};
|
||||||
|
|
||||||
|
$scope.sendProfileBackup = function() {
|
||||||
|
window.plugins.toast.showShortCenter('Preparing backup...');
|
||||||
|
var name = $rootScope.iden.fullName;
|
||||||
|
var ep = backupService.profileEncrypted($rootScope.iden);
|
||||||
|
var properties = {
|
||||||
|
subject: 'Copay Profile Backup: ' + name,
|
||||||
|
body: 'Here is the encrypted backup of the profile '
|
||||||
|
+ name + ': \n\n' + ep
|
||||||
|
+ '\n\n To import this backup, copy all text between {...}, including the symbols {}',
|
||||||
|
isHtml: false
|
||||||
|
};
|
||||||
|
window.plugin.email.open(properties);
|
||||||
|
};
|
||||||
|
|
||||||
$scope.init = function() {
|
$scope.init = function() {
|
||||||
if ($rootScope.quotaPerItem) {
|
if ($rootScope.quotaPerItem) {
|
||||||
|
|
|
||||||
|
|
@ -56,7 +56,7 @@
|
||||||
<button class="primary expand" ng-click="downloadWalletBackup()" ng-disabled="loading"
|
<button class="primary expand" ng-click="downloadWalletBackup()" ng-disabled="loading"
|
||||||
ng-show="!isSafari && !isCordova"><i class="fi-download"></i> Download backup</button>
|
ng-show="!isSafari && !isCordova"><i class="fi-download"></i> Download backup</button>
|
||||||
<button class="primary expand" ng-click="viewWalletBackup()" ng-disabled="loading"
|
<button class="primary expand" ng-click="viewWalletBackup()" ng-disabled="loading"
|
||||||
ng-show="isSafari && !isCordova"><i class="fi-eye"></i> View Backup</button>
|
ng-show="isSafari && !isCordova"><i class="fi-eye"></i> View backup</button>
|
||||||
<div ng-show="isCordova">
|
<div ng-show="isCordova">
|
||||||
<h4>Backup options</h4>
|
<h4>Backup options</h4>
|
||||||
<button class="primary expand"
|
<button class="primary expand"
|
||||||
|
|
|
||||||
|
|
@ -2,38 +2,54 @@
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="large-12 columns">
|
<div class="large-12 columns">
|
||||||
<div class="panel">
|
<div class="panel">
|
||||||
<div class="row">
|
<div class="row collapse">
|
||||||
<div class="large-2 medium-2 columns text-center">
|
<div class="large-2 medium-2 columns text-center">
|
||||||
<a class="photo-container profile" href="https://en.gravatar.com/" ng-init="isHover=0" ng-mouseenter="isHover=1" ng-mouseleave="isHover=0" target="_blank">
|
<a class="photo-container profile" href="https://en.gravatar.com/" ng-init="isHover=0" ng-mouseenter="isHover=1" ng-mouseleave="isHover=0" target="_blank">
|
||||||
<img ng-show="!isHover" gravatar-src="'{{username}}'" gravatar-size="80">
|
<img ng-show="!isHover" gravatar-src="'{{username}}'" gravatar-size="80">
|
||||||
<img ng-show="isHover" src="img/change-avatar.png" with="80">
|
<img ng-show="isHover" src="img/change-avatar.png" with="80">
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
<div class="large-7 medium-7 columns">
|
<div class="large-10 medium-10 columns">
|
||||||
<h2>Profile <span class="size-12 text-warning" ng-if="$root.iden.backupNeeded"> [ Needs Backup ]</span></h2>
|
<h2>Profile <span class="size-12 text-warning" ng-if="$root.iden.backupNeeded"> [ Needs Backup ]</span></h2>
|
||||||
<p translate class="text-gray">It's important to backup your profile so that you can recover it in case of disaster. The backup will include all your profile's wallets</p>
|
<span translate class="text-gray">It's important to backup your profile so that you can recover it in case
|
||||||
</div>
|
of disaster. The backup will include all your profile's wallets</span>
|
||||||
<div class="large-3 medium-3 columns">
|
</div>
|
||||||
<a translate class="button primary m0" ng-click="downloadProfileBackup()"
|
</div>
|
||||||
ng-show="!isSafari && !isCordova">Backup profile</a>
|
|
||||||
<a translate class="button primary m0" ng-click="viewProfileBackup()"
|
|
||||||
ng-show="isSafari || isCordova && !hideViewProfileBackup">View profile backup</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
<div class="row" ng-show="backupProfilePlainText">
|
|
||||||
<div class="large-12 columns">
|
|
||||||
<textarea class="show-for-large-up" readonly rows="5">{{backupProfilePlainText}}</textarea>
|
|
||||||
<textarea class="hide-for-large-up" rows="5">{{backupProfilePlainText}}</textarea>
|
|
||||||
<div translate class="size-12 m10t text-gray text-right">
|
|
||||||
Copy this text as it is in a safe place (notepad or email)
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div ng-show="$rootScope.quotaPerItem">
|
<div class="row" ng-show="!backupProfilePlainText">
|
||||||
|
<div class="large-12 columns">
|
||||||
|
<button class="primary expand" ng-click="downloadProfileBackup()" ng-disabled="loading"
|
||||||
|
ng-show="!isSafari && !isCordova"><i class="fi-download"></i> Download backup</button>
|
||||||
|
<button class="primary expand" ng-click="viewProfileBackup()" ng-disabled="loading"
|
||||||
|
ng-show="isSafari && !isCordova"><i class="fi-eye"></i> View backup</button>
|
||||||
|
<div ng-show="isCordova">
|
||||||
|
<h4>Backup options</h4>
|
||||||
|
<button class="primary expand"
|
||||||
|
ng-click="copyProfileBackup()"><i class="fi-clipboard-pencil"></i> Copy to clipboard</button>
|
||||||
|
<button class="primary expand"
|
||||||
|
ng-click="sendProfileBackup()"><i class="fi-mail"></i> Send by email</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row m20b" ng-show="backupProfilePlainText">
|
||||||
|
<div class="large-12 columns">
|
||||||
|
<h3>Copy backup in a safe place</h3>
|
||||||
|
<div class="input">
|
||||||
|
<textarea class="show-for-large-up" readonly rows="5">{{backupProfilePlainText}}</textarea>
|
||||||
|
<textarea class="hide-for-large-up" rows="5">{{backupProfilePlainText}}</textarea>
|
||||||
|
</div>
|
||||||
|
<div translate class="size-12 text-gray text-right">
|
||||||
|
<i class="icon-compose"></i>
|
||||||
|
Copy this text as it is in a safe place (notepad or email)
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div ng-show="$root.quotaPerItem">
|
||||||
<div class="line-dashed-h m20b"></div>
|
<div class="line-dashed-h m20b"></div>
|
||||||
|
|
||||||
<div class="row size-12 m20b">
|
<div class="row size-12 m20b">
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue