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