Merge branch 'master' into 'master'

fix: remove iOS saveFile workaround #20

See merge request timvisee/send!19
This commit is contained in:
Tim Visée 2021-07-08 21:12:06 +00:00
commit 54e528980b
1 changed files with 0 additions and 18 deletions

View File

@ -224,24 +224,6 @@ async function saveFile(file) {
if (navigator.msSaveBlob) {
navigator.msSaveBlob(blob, file.name);
return resolve();
} else if (/iPhone|fxios/i.test(navigator.userAgent)) {
// This method is much slower but createObjectURL
// is buggy on iOS
const reader = new FileReader();
reader.addEventListener('loadend', function() {
if (reader.error) {
return reject(reader.error);
}
if (reader.result) {
const a = document.createElement('a');
a.href = reader.result;
a.download = file.name;
document.body.appendChild(a);
a.click();
}
resolve();
});
reader.readAsDataURL(blob);
} else {
const downloadUrl = URL.createObjectURL(blob);
const a = document.createElement('a');