Merge pull request #2345 from cmgustavo/feature/mobile-backups-email
Feature/mobile copy backups and addresses
This commit is contained in:
commit
fe6c8d763a
8 changed files with 136 additions and 45 deletions
|
|
@ -100,6 +100,15 @@ if [ ! -d $PROJECT ]; then
|
|||
cordova plugin add org.apache.cordova.inappbrowser
|
||||
checkOK
|
||||
|
||||
cordova plugin add nl.x-services.plugins.toast && cordova prepare
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/VersoSolutions/CordovaClipboard
|
||||
checkOK
|
||||
|
||||
cordova plugin add https://github.com/katzer/cordova-plugin-email-composer.git
|
||||
checkOK
|
||||
|
||||
fi
|
||||
|
||||
if $DBGJS
|
||||
|
|
|
|||
|
|
@ -142,8 +142,30 @@ angular.module('copayApp.controllers').controller('MoreController',
|
|||
};
|
||||
|
||||
$scope.viewWalletBackup = function() {
|
||||
$scope.backupWalletPlainText = backupService.walletEncrypted(w);
|
||||
$scope.loading = true;
|
||||
$timeout(function() {
|
||||
$scope.backupWalletPlainText = backupService.walletEncrypted(w);
|
||||
}, 100);
|
||||
};
|
||||
|
||||
$scope.copyWalletBackup = function() {
|
||||
var ew = backupService.walletEncrypted(w);
|
||||
window.cordova.plugins.clipboard.copy(ew);
|
||||
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||
};
|
||||
|
||||
$scope.sendWalletBackup = function() {
|
||||
window.plugins.toast.showShortCenter('Preparing backup...');
|
||||
var name = (w.name || w.id);
|
||||
var ew = backupService.walletEncrypted(w);
|
||||
var properties = {
|
||||
subject: 'Copay Wallet Backup: ' + name,
|
||||
body: 'Here is the encrypted backup of the wallet '
|
||||
+ name + ': \n\n' + ew
|
||||
+ '\n\n To import this backup, copy all text between {...}, including the symbols {}',
|
||||
isHtml: false
|
||||
};
|
||||
window.plugin.email.open(properties);
|
||||
};
|
||||
|
||||
});
|
||||
|
|
|
|||
|
|
@ -12,10 +12,31 @@ angular.module('copayApp.controllers').controller('ProfileController', function(
|
|||
};
|
||||
|
||||
$scope.viewProfileBackup = function() {
|
||||
$scope.backupProfilePlainText = backupService.profileEncrypted($rootScope.iden);
|
||||
$scope.hideViewProfileBackup = true;
|
||||
$scope.loading = 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() {
|
||||
if ($rootScope.quotaPerItem) {
|
||||
|
|
|
|||
|
|
@ -1,17 +1,20 @@
|
|||
'use strict';
|
||||
|
||||
angular.module('copayApp.controllers').controller('ReceiveController',
|
||||
function($scope, $rootScope, $timeout, $modal) {
|
||||
function($scope, $rootScope, $timeout, $modal, isCordova) {
|
||||
|
||||
$scope.newAddr = function() {
|
||||
var w = $rootScope.wallet;
|
||||
$scope.loading = true;
|
||||
var lastAddr = w.generateAddress(null);
|
||||
$scope.setAddressList();
|
||||
$scope.addr = lastAddr;
|
||||
$timeout(function() {
|
||||
$scope.loading = false;
|
||||
}, 1);
|
||||
};
|
||||
|
||||
$scope.copyAddress = function(addr) {
|
||||
if (isCordova) {
|
||||
window.cordova.plugins.clipboard.copy(addr);
|
||||
window.plugins.toast.showShortCenter('Copied to clipboard');
|
||||
}
|
||||
};
|
||||
|
||||
$scope.init = function() {
|
||||
|
|
@ -32,8 +35,13 @@ angular.module('copayApp.controllers').controller('ReceiveController',
|
|||
};
|
||||
|
||||
$scope.openAddressModal = function(address) {
|
||||
var scope = $scope;
|
||||
var ModalInstanceCtrl = function($scope, $modalInstance, address) {
|
||||
$scope.address = address;
|
||||
$scope.isCordova = isCordova;
|
||||
$scope.copyAddress = function(addr) {
|
||||
scope.copyAddress(addr);
|
||||
};
|
||||
|
||||
$scope.cancel = function() {
|
||||
$modalInstance.dismiss('cancel');
|
||||
|
|
|
|||
|
|
@ -1,13 +1,19 @@
|
|||
<div class="text-center m20t">
|
||||
<qrcode size="220" data="{{address.address}}"></qrcode>
|
||||
<div class="text-center m20t" ng-init="addr = address.address">
|
||||
<qrcode size="220" data="{{addr}}"></qrcode>
|
||||
|
||||
<div class="m10t" ng-init="label = $root.wallet.addressBook[address.address].label">
|
||||
<div class="m10t"
|
||||
ng-init="label = $root.wallet.addressBook[addr].label">
|
||||
<div class="size-12">
|
||||
{{address.address}} <small class="label" ng-show="address.isChange">change</small>
|
||||
{{addr}} <small class="label" ng-show="address.isChange">change</small>
|
||||
</div>
|
||||
<b class="db m5t" ng-show="label">
|
||||
({{label}})
|
||||
</b>
|
||||
</div>
|
||||
<div class="text-center m10t" ng-if="isCordova">
|
||||
<button class="primary expand" ng-click="copyAddress(addr)">
|
||||
Copy to clipboard
|
||||
</button>
|
||||
</div>
|
||||
<a class="close-reveal-modal" ng-click="cancel()"><i class="fi-x size-18"></i></a>
|
||||
</div>
|
||||
|
|
|
|||
|
|
@ -56,19 +56,26 @@
|
|||
<button class="primary expand" ng-click="downloadWalletBackup()" ng-disabled="loading"
|
||||
ng-show="!isSafari && !isCordova"><i class="fi-download"></i> Download backup</button>
|
||||
<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">
|
||||
<h4>Backup options</h4>
|
||||
<button class="primary expand"
|
||||
ng-click="copyWalletBackup()"><i class="fi-clipboard-pencil"></i> Copy to clipboard</button>
|
||||
<button class="primary expand"
|
||||
ng-click="sendWalletBackup()"><i class="fi-mail"></i> Send by email</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row" ng-show="backupWalletPlainText">
|
||||
<div class="row m20b" ng-show="backupWalletPlainText">
|
||||
<div class="large-12 columns">
|
||||
<h3>Copy backup in a safe place</h3>
|
||||
<div class="input">
|
||||
<textarea class="show-for-large-up" readonly rows="7">{{backupWalletPlainText}}</textarea>
|
||||
<textarea class="hide-for-large-up" rows="12">{{backupWalletPlainText}}</textarea>
|
||||
<i class="icon-compose"></i>
|
||||
</div>
|
||||
<div translate class="m10t size-12 text-gray text-right">
|
||||
<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>
|
||||
|
|
|
|||
|
|
@ -2,49 +2,67 @@
|
|||
<div class="row">
|
||||
<div class="large-12 columns">
|
||||
<div class="panel">
|
||||
<div class="row">
|
||||
<div class="row collapse">
|
||||
<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">
|
||||
<img ng-show="!isHover" gravatar-src="'{{username}}'" gravatar-size="80">
|
||||
<img ng-show="isHover" src="img/change-avatar.png" with="80">
|
||||
</a>
|
||||
</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>
|
||||
<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>
|
||||
</div>
|
||||
<div class="large-3 medium-3 columns">
|
||||
<a translate class="button primary m0" ng-click="downloadProfileBackup()"
|
||||
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>
|
||||
<span 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</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="line-dashed-h m20b"></div>
|
||||
|
||||
<div class="row size-12 m20b">
|
||||
<div class="row" ng-show="!backupProfilePlainText">
|
||||
<div class="large-12 columns">
|
||||
<div ng-if="perItem">
|
||||
Your current server usage quotas are: <b>{{perItem}}kB</b> per wallet and up to <b>{{nrWallets}}</b> wallets.
|
||||
</div>
|
||||
<div ng-if="$root.needsEmailConfirmation" class="m10t">
|
||||
<i class="fi-alert"></i> Confirm your email address to increase storage usage limits.
|
||||
<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>
|
||||
|
||||
<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="row size-12 m20b">
|
||||
<div class="large-12 columns">
|
||||
<div ng-if="perItem">
|
||||
Your current server usage quotas are: <b>{{perItem}}kB</b> per wallet and up to <b>{{nrWallets}}</b> wallets.
|
||||
</div>
|
||||
<div ng-if="$root.needsEmailConfirmation" class="m10t">
|
||||
<i class="fi-alert"></i> Confirm your email address to increase storage usage limits.
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="line-dashed-h m20b"></div>
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@
|
|||
<div class="large-12 columns">
|
||||
<div class="panel">
|
||||
<h2 class="line-b" translate>My Bitcoin address:</h2>
|
||||
<div class="text-center">
|
||||
<div class="text-center" ng-click="copyAddress(addr)">
|
||||
<qrcode size="220" data="bitcoin:{{addr}}"></qrcode>
|
||||
<div class="m10t">
|
||||
<h4 class="size-12">{{addr}}</h4>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue