From d09f85413b0f0d13307ed0fdf15039fb1f10c76e Mon Sep 17 00:00:00 2001 From: Richard de Boer Date: Tue, 7 Jun 2022 21:44:54 +0200 Subject: [PATCH] cogclock: Use ClockFace_menu.addSettingsFile --- apps/cogclock/ChangeLog | 2 +- apps/cogclock/settings.js | 15 +++------------ 2 files changed, 4 insertions(+), 13 deletions(-) diff --git a/apps/cogclock/ChangeLog b/apps/cogclock/ChangeLog index 684b22642..f4bfe77a5 100644 --- a/apps/cogclock/ChangeLog +++ b/apps/cogclock/ChangeLog @@ -1,3 +1,3 @@ 0.01: New clock 0.02: Use ClockFace library, add settings -0.03: Use ClockFace_menu.addItems \ No newline at end of file +0.03: Use ClockFace_menu.addSettingsFile diff --git a/apps/cogclock/settings.js b/apps/cogclock/settings.js index a6627d6d2..a91b033d0 100644 --- a/apps/cogclock/settings.js +++ b/apps/cogclock/settings.js @@ -1,19 +1,10 @@ (function(back) { - let s = require('Storage').readJSON("cogclock.settings.json", true) || {}; - - function save(key, value) { - s[key] = value; - require("Storage").writeJSON("cogclock.settings.json", s); - } - let menu = { "": {"title": /*LANG*/"Cog Clock"}, /*LANG*/"< Back": back, }; - require("ClockFace_menu").addItems(menu, save, { - showDate: s.showDate, - loadWidgets: s.loadWidgets, - }); - + require("ClockFace_menu").addSettingsFile(menu, "cogclock.settings.json", [ + "showDate", "loadWidgets" + ]); E.showMenu(menu); });