widbatpc: Save settings in data file

master
Richard de Boer 2020-04-17 21:25:56 +02:00
parent 745e4d38a9
commit 43b0d8897e
4 changed files with 8 additions and 5 deletions

View File

@ -342,14 +342,16 @@
"name": "Battery Level Widget (with percentage)", "name": "Battery Level Widget (with percentage)",
"shortName": "Battery Widget", "shortName": "Battery Widget",
"icon": "widget.png", "icon": "widget.png",
"version":"0.09", "version":"0.10",
"description": "Show the current battery level and charging status in the top right of the clock, with charge percentage", "description": "Show the current battery level and charging status in the top right of the clock, with charge percentage",
"tags": "widget,battery", "tags": "widget,battery",
"type":"widget", "type":"widget",
"storage": [ "storage": [
{"name":"widbatpc.wid.js","url":"widget.js"}, {"name":"widbatpc.wid.js","url":"widget.js"},
{"name":"widbatpc.settings.js","url":"settings.js"}, {"name":"widbatpc.settings.js","url":"settings.js"}
{"name":"widbatpc.settings.json","content": "{}"} ],
"data": [
{"name":"widbatpc.json"}
] ]
}, },
{ "id": "widbt", { "id": "widbt",

View File

@ -6,3 +6,4 @@
0.07: Add settings: percentage/color/charger icon 0.07: Add settings: percentage/color/charger icon
0.08: Draw percentage as inverted on monochrome battery 0.08: Draw percentage as inverted on monochrome battery
0.09: Fix regression stopping correct widget updates 0.09: Fix regression stopping correct widget updates
0.10: Don't overwrite existing settings on app update

View File

@ -3,7 +3,7 @@
* @param {function} back Use back() to return to settings menu * @param {function} back Use back() to return to settings menu
*/ */
(function(back) { (function(back) {
const SETTINGS_FILE = 'widbatpc.settings.json' const SETTINGS_FILE = 'widbatpc.json'
const COLORS = ['By Level', 'Green', 'Monochrome'] const COLORS = ['By Level', 'Green', 'Monochrome']
// initialize with default settings... // initialize with default settings...

View File

@ -11,7 +11,7 @@ const COLORS = {
'ok': 0xFD20, // "Orange" 'ok': 0xFD20, // "Orange"
'low':0xF800, // "Red" 'low':0xF800, // "Red"
} }
const SETTINGS_FILE = 'widbatpc.settings.json' const SETTINGS_FILE = 'widbatpc.json'
let settings let settings
function loadSettings() { function loadSettings() {