1
0
Fork 0

Allow installation of a backup without an erase

master
Gordon Williams 2023-05-04 12:06:31 +01:00
parent 1c79c76193
commit f1f590a3f5
1 changed files with 10 additions and 5 deletions

View File

@ -70,7 +70,7 @@ function bangleUpload() {
var zip = new JSZip(); var zip = new JSZip();
var cmds = ""; var cmds = "";
zip.loadAsync(data).then(function(zip) { 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(()=>{ }).then(()=>{
Progress.show({title:`Reading ZIP`}); Progress.show({title:`Reading ZIP`});
zip.forEach(function (path, file){ zip.forEach(function (path, file){
@ -91,10 +91,15 @@ function bangleUpload() {
}); });
return promise; return promise;
}) })
.then(() => { .then(()=>new Promise(resolve => {
Progress.hide({sticky:true}); 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));
Progress.show({title:`Erasing...`}); }))
return Comms.removeAllApps(); }) .then(eraseStorage => {
if (eraseStorage) {
Progress.hide({sticky:true});
Progress.show({title:`Erasing...`});
return Comms.removeAllApps();
}})
.then(() => { .then(() => {
Progress.hide({sticky:true}); Progress.hide({sticky:true});
Progress.show({title:`Restoring...`, sticky:true}); Progress.show({title:`Restoring...`, sticky:true});