mirror of https://github.com/espruino/BangleApps
Logo, about page, set time + erase all apps option
parent
821bf21046
commit
5e9d2e010a
22
comms.js
22
comms.js
|
@ -35,7 +35,7 @@ uploadApp : app => {
|
|||
Puck.write("\x03reset();\n", (result) => {
|
||||
if (result===null) return reject("");
|
||||
setTimeout(() => { // wait for reset
|
||||
Puck.write(fileContents,(result) => {
|
||||
Puck.write("\x10E.showMessage('Uploading...')\n"+fileContents+"load()\n",(result) => {
|
||||
if (result===null) return reject("");
|
||||
resolve();
|
||||
});
|
||||
|
@ -67,5 +67,25 @@ removeApp : app => { // expects an app structure
|
|||
resolve();
|
||||
});
|
||||
});
|
||||
},
|
||||
removeAllApps : () => {
|
||||
return new Promise((resolve,reject) => {
|
||||
// Use eval here so we wait for it to finish
|
||||
Puck.eval('require("Storage").eraseAll()||true', (result,err) => {
|
||||
if (result===null) return reject(err || "");
|
||||
Puck.write('\x03\x10reset()\n',(result) => {
|
||||
if (result===null) return reject("");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
});
|
||||
},
|
||||
setTime : () => {
|
||||
return new Promise((resolve,reject) => {
|
||||
Puck.setTime((result) => {
|
||||
if (result===null) return reject("");
|
||||
resolve();
|
||||
});
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Binary file not shown.
After Width: | Height: | Size: 6.2 KiB |
Binary file not shown.
After Width: | Height: | Size: 2.2 KiB |
20
index.html
20
index.html
|
@ -21,13 +21,18 @@
|
|||
position:absolute;
|
||||
bottom:8px;left:0px;right:0px;
|
||||
z-index: 100;
|
||||
}
|
||||
.hero {
|
||||
padding-bottom: 1rem;
|
||||
padding-top: 1rem;
|
||||
text-align:center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header class="navbar-primary navbar">
|
||||
<section class="navbar-section">
|
||||
<a href="#" class="navbar-brand mr-2">Bangle.js Loader</a>
|
||||
<a href="https://banglejs.com" class="navbar-brand mr-2"><img src="img/banglejs-logo-sml.png" alt="Bangle.js"> App Loader</a>
|
||||
<!-- <a href="#" class="btn btn-link">...</a> -->
|
||||
</section>
|
||||
<!--<section class="navbar-section">
|
||||
|
@ -75,7 +80,7 @@
|
|||
<div class="container bangle-tab" id="myappscontainer" style="display:none">
|
||||
<div class="panel">
|
||||
<div class="panel-header" style="text-align:right">
|
||||
<button class="btn input-group-btn" id="myappsrefresh">Refresh...</button>
|
||||
<button class="btn" id="myappsrefresh">Refresh...</button>
|
||||
</div>
|
||||
<div class="panel-body columns"><!-- apps go here --></div>
|
||||
</div>
|
||||
|
@ -84,11 +89,20 @@
|
|||
<div class="container bangle-tab" id="aboutcontainer" style="display:none">
|
||||
<div class="hero bg-gray">
|
||||
<div class="hero-body">
|
||||
<h1>Bangle.js Loader</h1>
|
||||
<a href="https://banglejs.com"><img src="img/banglejs-logo-mid.png" alt="Bangle.js"></a>
|
||||
<h2>App Loader</h2>
|
||||
<p>A tool for uploading and removing apps from <a href="https://banglejs.com">Bangle.js Smart Watches</a></p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="container" style="padding-top: 8px;">
|
||||
<p>Using <a href="https://espruino.com/">Espruino</a>, Icons from <a href="https://icons8.com/">icons8.com</a></p>
|
||||
<p>Check out <a href="https://github.com/espruino/BangleApps">the Source on GitHub</a> for more information.</p>
|
||||
|
||||
|
||||
<h3>Utilities</h3>
|
||||
<p><button class="btn" id="settime">Set Bangle.js Time</button>
|
||||
<button class="btn" id="removeall">Remove all Apps</button></p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="https://www.puck-js.com/puck.js"></script>
|
||||
|
|
22
index.js
22
index.js
|
@ -263,3 +263,25 @@ function getInstalledApps() {
|
|||
document.getElementById("myappsrefresh").addEventListener("click",event=>{
|
||||
getInstalledApps();
|
||||
});
|
||||
|
||||
// =========================================== About
|
||||
|
||||
document.getElementById("settime").addEventListener("click",event=>{
|
||||
Comms.setTime().then(()=>{
|
||||
showToast("Time set successfully","success");
|
||||
}, err=>{
|
||||
showToast("Error setting time, "+err,"error");
|
||||
});
|
||||
});
|
||||
document.getElementById("removeall").addEventListener("click",event=>{
|
||||
showPrompt("Remove All","Really remove all apps?").then(() => {
|
||||
Comms.removeAllApps().then(()=>{
|
||||
appsInstalled = [];
|
||||
showToast("All apps removed","success");
|
||||
refreshMyApps();
|
||||
refreshLibrary();
|
||||
}, err=>{
|
||||
showToast("App removal failed, "+err,"error");
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue