From e121d0acb6c1bc93953d0e148ff206a65afa1657 Mon Sep 17 00:00:00 2001 From: Yemel Jardi Date: Fri, 25 Jul 2014 09:50:06 -0300 Subject: [PATCH] Send email backup with file attached --- js/services/backupService.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/js/services/backupService.js b/js/services/backupService.js index 41fbe559f..dc915d632 100644 --- a/js/services/backupService.js +++ b/js/services/backupService.js @@ -30,13 +30,14 @@ BackupService.prototype.download = function(wallet) { } // throw an email intent if we are in the mobile version - if (window.xwalk) { + if (window.cordova) { var name = wallet.name ? wallet.name + ' ' : ''; var partial = partial ? 'Partial ' : ''; - var subject = 'Copay - ' + name + 'Wallet ' + partial + 'Backup'; - var body = 'This is the encrypted backup of the wallet ' + wallet.id + ':\n\n' + ew; - var mailURL = encodeURI('mailto:?subject=' + subject + '&body=' + body); - return window.open(mailURL,'_blank'); + return window.plugin.email.open({ + subject: 'Copay - ' + name + 'Wallet ' + partial + 'Backup', + body: 'Here is the encrypted backup of the wallet ' + wallet.id, + attachments: ['base64:' + filename + '//' + btoa(ew)] + }); } // otherwise lean on the browser implementation