diff --git a/src/js/controllers/index.js b/src/js/controllers/index.js index f52ec3e84..138d1e80a 100644 --- a/src/js/controllers/index.js +++ b/src/js/controllers/index.js @@ -694,19 +694,6 @@ angular.module('copayApp.controllers').controller('indexController', function($r self.csvHistory = function() { - function saveFile(name, data) { - var chooser = document.querySelector(name); - chooser.addEventListener("change", function(evt) { - var fs = require('fs'); - fs.writeFile(this.value, data, function(err) { - if (err) { - $log.debug(err); - } - }); - }, false); - chooser.click(); - } - function formatDate(date) { var dateObj = new Date(date); if (!dateObj) { diff --git a/src/js/services/backupService.js b/src/js/services/backupService.js index 747079d6c..60a443ad8 100644 --- a/src/js/services/backupService.js +++ b/src/js/services/backupService.js @@ -31,25 +31,18 @@ angular.module('copayApp.services') }); $log.debug("case 3"); } else { - // We're screwed, blob constructor unsupported entirely + // We're screwed, blob constructor unsupported entirely $log.debug("Error"); } } return out; }; - var a = document.createElement("a"); - document.body.appendChild(a); - a.style.display = "none"; - + var a = angular.element(''); var blob = new NewBlob(ew, 'text/plain;charset=utf-8'); - var url = window.URL.createObjectURL(blob); - a.href = url; - a.download = filename; - a.click(); - $timeout(function() { - window.URL.revokeObjectURL(url); - }, 250); + a.attr('href',window.URL.createObjectURL(blob)); + a.attr('download', filename); + a[0].click(); return cb(); }; @@ -92,4 +85,4 @@ angular.module('copayApp.services') _download(ew, filename, cb) }; return root; - }); \ No newline at end of file + });