forked from FOSS/BangleApps
Add 'reinstall apps' button
parent
48efab699d
commit
00f1de401a
|
@ -128,9 +128,10 @@
|
|||
|
||||
<h3>Utilities</h3>
|
||||
<p><button class="btn" id="settime">Set Bangle.js Time</button>
|
||||
<button class="btn" id="removeall">Remove all Apps</button>
|
||||
<button class="btn" id="removeall" data-tooltip="Delete everything from your Bangle, leaving it blank">Remove all Apps</button>
|
||||
<button class="btn" id="reinstallall" data-tooltip="Remove and re-install every app, leaving all other data intact">Reinstall apps</button>
|
||||
<button class="btn" id="installdefault">Install default apps</button>
|
||||
<button class="btn" id="installfavourite">Install favourite apps</button></p>
|
||||
<button class="btn" id="installfavourite" data-tooltip="Delete everything, install apps you've marked as favourites">Install favourite apps</button></p>
|
||||
<p><button class="btn tooltip tooltip-right" id="downloadallapps" data-tooltip="Download all Bangle.js files to a ZIP file">Backup</button>
|
||||
<button class="btn tooltip tooltip-right" id="uploadallapps" data-tooltip="Restore Bangle.js from a ZIP file">Restore</button></p>
|
||||
<h3>Settings</h3>
|
||||
|
@ -179,6 +180,6 @@
|
|||
<script src="core/js/appinfo.js"></script>
|
||||
<script src="core/js/index.js"></script>
|
||||
<script src="core/js/pwa.js" defer></script>
|
||||
<script src="gadgetbridge.js"></script>
|
||||
<script src="gadgetbridge.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
|
|
23
loader.js
23
loader.js
|
@ -155,6 +155,29 @@ window.addEventListener('load', (event) => {
|
|||
});
|
||||
});
|
||||
|
||||
// Button to install all default apps in one go
|
||||
document.getElementById("reinstallall").addEventListener("click",event=>{
|
||||
var promise = showPrompt("Reinstall","Really re-install all apps?").then(() => {
|
||||
getInstalledApps().then(installedapps => {
|
||||
console.log(installedapps);
|
||||
var promise = Promise.resolve();
|
||||
installedapps.forEach(app => {
|
||||
if (app.custom)
|
||||
return console.log(`Ignoring ${app.id} as customised`);
|
||||
var oldApp = app;
|
||||
app = appJSON.find(a => a.id==oldApp.id);
|
||||
if (!app)
|
||||
return console.log(`Ignoring ${oldApp.id} as not found`);
|
||||
promise = promise.then(() => updateApp(app));
|
||||
});
|
||||
return promise;
|
||||
}).catch(err=>{
|
||||
Progress.hide({sticky:true});
|
||||
showToast("App re-install failed, "+err,"error");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
// Button to install all default apps in one go
|
||||
document.getElementById("installdefault").addEventListener("click",event=>{
|
||||
getInstalledApps().then(() => {
|
||||
|
|
Loading…
Reference in New Issue