On Android, try and use saveFile for backups

pull/3571/head
Gordon Williams 2024-09-12 13:03:03 +01:00
parent 431100f724
commit 144bf5a28a
1 changed files with 6 additions and 1 deletions

View File

@ -53,7 +53,12 @@ function bangleDownload() {
}).then(content => { }).then(content => {
Progress.hide({ sticky: true }); Progress.hide({ sticky: true });
showToast('Backup complete!', 'success'); showToast('Backup complete!', 'success');
if (typeof Android !== "undefined" && typeof Android.saveFile === 'function') {
// Recent Gadgetbridge version that provides the saveFile interface
Android.saveFile("Banglejs backup.zip", "application/zip", content);
} else {
Espruino.Core.Utils.fileSaveDialog(content, "Banglejs backup.zip"); Espruino.Core.Utils.fileSaveDialog(content, "Banglejs backup.zip");
}
}).catch(err => { }).catch(err => {
Progress.hide({ sticky: true }); Progress.hide({ sticky: true });
showToast('Backup failed, ' + err, 'error'); showToast('Backup failed, ' + err, 'error');