From f1f590a3f5d6d47bf4feb97c4a736f594da8d4a2 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 4 May 2023 12:06:31 +0100 Subject: [PATCH] Allow installation of a backup without an erase --- backup.js | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/backup.js b/backup.js index 06d98a366..09f65af99 100644 --- a/backup.js +++ b/backup.js @@ -70,7 +70,7 @@ function bangleUpload() { var zip = new JSZip(); var cmds = ""; zip.loadAsync(data).then(function(zip) { - return showPrompt("Restore from ZIP","Are you sure? This will remove all existing apps"); + return showPrompt("Restore from ZIP","Are you sure? This will overwrite existing apps"); }).then(()=>{ Progress.show({title:`Reading ZIP`}); zip.forEach(function (path, file){ @@ -91,10 +91,15 @@ function bangleUpload() { }); return promise; }) - .then(() => { - Progress.hide({sticky:true}); - Progress.show({title:`Erasing...`}); - return Comms.removeAllApps(); }) + .then(()=>new Promise(resolve => { + showPrompt("Erase Storage","Erase Storage? If restoring a complete backup you should erase storage, but in some cases you may want to upload files from a ZIP while keeping your Bangle's existing data.").then(()=>resolve(true), ()=>resolve(false)); + })) + .then(eraseStorage => { + if (eraseStorage) { + Progress.hide({sticky:true}); + Progress.show({title:`Erasing...`}); + return Comms.removeAllApps(); + }}) .then(() => { Progress.hide({sticky:true}); Progress.show({title:`Restoring...`, sticky:true});