Merge pull request #3966 from Trippnology/deko-optional-widgets
Deko: Add settings menu and make widgets optionalmaster
commit
91a7d6edf9
|
|
@ -1 +1,2 @@
|
||||||
0.01: first release
|
0.01: First release
|
||||||
|
0.02: Add setting to make widgets optional
|
||||||
|
|
@ -1,10 +1,14 @@
|
||||||
# Deko Clock
|
# Deko Clock
|
||||||
|
|
||||||
A simple clock with an Art Deko font
|
A simple clock with an Art Deko font.
|
||||||
|
|
||||||
The font was obtained from https://dafonttop.com/building.font and is free for personal use
|
Widgets can be configured to be always on, always off, or only shown when unlocked.
|
||||||
|
|
||||||
|
The font was obtained from https://dafonttop.com/building.font and is free for personal use.
|
||||||
|
|
||||||

|
 
|
||||||
|
|
||||||
Written by: [Hugh Barney](https://github.com/hughbarney) For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
|
Written by: [Hugh Barney](https://github.com/hughbarney)
|
||||||
|
Optional widgets settings added by [Trippnology](https://github.com/trippnology)
|
||||||
|
|
||||||
|
For support and discussion please post in the [Bangle JS Forum](http://forum.espruino.com/microcosms/1424/)
|
||||||
|
|
|
||||||
File diff suppressed because one or more lines are too long
|
|
@ -1,16 +1,21 @@
|
||||||
{
|
{
|
||||||
"id": "deko",
|
"id": "deko",
|
||||||
"name": "Deko Clock",
|
"name": "Deko Clock",
|
||||||
"version": "0.01",
|
"version": "0.02",
|
||||||
"description": "Clock with Art Deko font",
|
"description": "Clock with Art Deko font",
|
||||||
"readme": "README.md",
|
"readme": "README.md",
|
||||||
"icon": "app.png",
|
"icon": "app.png",
|
||||||
"screenshots": [{"url":"screenshot.png"}],
|
"screenshots": [
|
||||||
|
{ "url": "screenshot.png" },
|
||||||
|
{ "url": "screenshot-no-widgets.png" }
|
||||||
|
],
|
||||||
"type": "clock",
|
"type": "clock",
|
||||||
"tags": "clock",
|
"tags": "clock",
|
||||||
"supports": ["BANGLEJS", "BANGLEJS2"],
|
"supports": ["BANGLEJS", "BANGLEJS2"],
|
||||||
"storage": [
|
"storage": [
|
||||||
{ "name": "deko.app.js", "url": "app.js" },
|
{ "name": "deko.app.js", "url": "app.js" },
|
||||||
|
{ "name": "deko.settings.js", "url": "settings.js" },
|
||||||
{ "name": "deko.img", "url": "app-icon.js", "evaluate": true }
|
{ "name": "deko.img", "url": "app-icon.js", "evaluate": true }
|
||||||
]
|
],
|
||||||
|
"data": [{ "name": "deko.settings.json" }]
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Binary file not shown.
|
After Width: | Height: | Size: 2.5 KiB |
|
|
@ -0,0 +1,32 @@
|
||||||
|
(function (back) {
|
||||||
|
const storage = require('Storage');
|
||||||
|
const settingsFile = 'deko.settings.json';
|
||||||
|
const defaultSettings = {
|
||||||
|
loadWidgets: 1,
|
||||||
|
};
|
||||||
|
const settings = Object.assign(
|
||||||
|
defaultSettings,
|
||||||
|
storage.readJSON(settingsFile, 1) || {},
|
||||||
|
);
|
||||||
|
const loadWidgetsChoices = ['No', 'Yes', 'Unlocked'];
|
||||||
|
|
||||||
|
const save = () => storage.write(settingsFile, settings);
|
||||||
|
|
||||||
|
const appMenu = {
|
||||||
|
'': { title: 'Deko Clock' },
|
||||||
|
'< Back': back,
|
||||||
|
'Load widgets?': {
|
||||||
|
value: settings.loadWidgets,
|
||||||
|
min: 0,
|
||||||
|
max: 2,
|
||||||
|
step: 1,
|
||||||
|
format: (v) => loadWidgetsChoices[v],
|
||||||
|
onchange: (v) => {
|
||||||
|
settings.loadWidgets = v;
|
||||||
|
save();
|
||||||
|
},
|
||||||
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
E.showMenu(appMenu);
|
||||||
|
})
|
||||||
Loading…
Reference in New Issue