forked from FOSS/BangleApps
Tweaks to appease the sanity checker
parent
30e982f06a
commit
4391b48aeb
|
@ -344,6 +344,9 @@ that handles configuring the app.
|
|||
When the app settings are opened, this function is called with one
|
||||
argument, `back`: a callback to return to the settings menu.
|
||||
|
||||
Usually it will save any information in `app.json` where `app` is the name
|
||||
of your app - so you should change the example accordingly.
|
||||
|
||||
Example `settings.js`
|
||||
```js
|
||||
// make sure to enclose the function in parentheses
|
||||
|
|
16
apps.json
16
apps.json
|
@ -168,7 +168,7 @@
|
|||
"name": "Image background clock",
|
||||
"shortName":"Image Clock",
|
||||
"icon": "app.png",
|
||||
"version":"0.05",
|
||||
"version":"0.06",
|
||||
"description": "A clock with an image as a background",
|
||||
"tags": "clock",
|
||||
"type" : "clock",
|
||||
|
@ -1469,7 +1469,7 @@
|
|||
"name": "Round clock with seconds, minutes and date",
|
||||
"shortName":"Round Clock",
|
||||
"icon": "app.png",
|
||||
"version":"0.02",
|
||||
"version":"0.03",
|
||||
"description": "Designed round clock with ticks for minutes and seconds and heart rate indication",
|
||||
"tags": "clock",
|
||||
"type": "clock",
|
||||
|
@ -1572,7 +1572,7 @@
|
|||
"id": "largeclock",
|
||||
"name": "Large Clock",
|
||||
"icon": "largeclock.png",
|
||||
"version": "0.02",
|
||||
"version": "0.03",
|
||||
"description": "A readable and informational digital watch, with date, seconds and moon phase",
|
||||
"readme": "README.md",
|
||||
"tags": "clock",
|
||||
|
@ -1591,12 +1591,10 @@
|
|||
{
|
||||
"name": "largeclock.settings.js",
|
||||
"url": "settings.js"
|
||||
},
|
||||
{
|
||||
"name": "largeclock.json",
|
||||
"url": "largeclock.json",
|
||||
"evaluate": true
|
||||
}
|
||||
],
|
||||
"data": [
|
||||
{"name":"largeclock.json"}
|
||||
]
|
||||
},
|
||||
{ "id": "smtswch",
|
||||
|
@ -1708,7 +1706,7 @@
|
|||
{ "name": "gallifr.settings.js", "url": "settings.js" }
|
||||
],
|
||||
"data": [
|
||||
{"name":"app.json"}
|
||||
{"name":"gallifr.json"}
|
||||
]
|
||||
}
|
||||
]
|
|
@ -10,7 +10,7 @@ const cirRad = 2*Math.PI;
|
|||
const proportion = 0.3; // relative size of hour hand
|
||||
const thickness = 4; // thickness of decorative lines
|
||||
// retrieve settings from menu
|
||||
let settings = require('Storage').readJSON('app.json',1)||{};
|
||||
let settings = require('Storage').readJSON('gallifr.json',1)||{};
|
||||
const decoration = !settings.decoration;
|
||||
const widgets = !settings.widgets;
|
||||
if (widgets) {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
// make sure to enclose the function in parentheses
|
||||
(function (back) {
|
||||
let settings = require('Storage').readJSON('app.json',1)||{};
|
||||
let settings = require('Storage').readJSON('gallifr.json',1)||{};
|
||||
let colours = ["green","red","blue","80s"];
|
||||
let onoff = ["on","off"];
|
||||
function save(key, value) {
|
||||
settings[key] = value;
|
||||
require('Storage').write('app.json',settings);
|
||||
require('Storage').writeJSON('gallifr.json',settings);
|
||||
}
|
||||
const appMenu = {
|
||||
'': {'title': 'Clock Settings'},
|
||||
|
|
|
@ -1,2 +1,3 @@
|
|||
0.01: Init
|
||||
0.02: fix 3/4 moon orientation
|
||||
0.03: Change `largeclock.json` to 'data' file to allow settings to be preserved
|
||||
|
|
|
@ -9,10 +9,8 @@ const moonX = 215;
|
|||
const moonY = 50;
|
||||
|
||||
const settings = require("Storage").readJSON("largeclock.json", 1);
|
||||
const BTN1app = settings.BTN1;
|
||||
const BTN3app = settings.BTN3;
|
||||
console.log("BTN1app", BTN1app);
|
||||
console.log("BTN3app", BTN3app);
|
||||
const BTN1app = settings.BTN1 || "";
|
||||
const BTN3app = settings.BTN3 || "";
|
||||
|
||||
function drawMoon(d) {
|
||||
const BLACK = 0,
|
||||
|
@ -174,14 +172,14 @@ Bangle.setLCDMode();
|
|||
// Show launcher when middle button pressed
|
||||
clearWatch();
|
||||
setWatch(Bangle.showLauncher, BTN2, { repeat: false, edge: "falling" });
|
||||
setWatch(
|
||||
if (BTN1app) setWatch(
|
||||
function() {
|
||||
load(BTN1app);
|
||||
},
|
||||
BTN1,
|
||||
{ repeat: false, edge: "rising" }
|
||||
);
|
||||
setWatch(
|
||||
if (BTN3app) setWatch(
|
||||
function() {
|
||||
load(BTN3app);
|
||||
},
|
||||
|
|
|
@ -34,7 +34,7 @@
|
|||
|
||||
function onchange(v) {
|
||||
settings[btn] = v;
|
||||
s.write("largeclock.json", settings);
|
||||
s.writeJSON("largeclock.json", settings);
|
||||
}
|
||||
|
||||
const btnMenu = {
|
||||
|
|
Loading…
Reference in New Issue