Send email backup with file attached

This commit is contained in:
Yemel Jardi 2014-07-25 09:50:06 -03:00
parent 053718884a
commit e121d0acb6
1 changed files with 6 additions and 5 deletions

View File

@ -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