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
|
|
@ -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');
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue