From 3e5c0538a9776014a7f99d8c3521d1372dde8a90 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Tue, 6 Dec 2022 10:25:32 +0000 Subject: [PATCH] Support for provides_widgets entry in metadata, and try and tag existing widgets Support for 'default' tag and add it to apps that we expect would be used by default with the Bangle split widalarm out of alarm fixes https://github.com/espruino/BangleApps/issues/2353 --- README.md | 5 ++++- apps/alarm/ChangeLog | 2 +- apps/alarm/metadata.json | 9 ++++----- apps/launch/metadata.json | 1 + apps/messagegui/metadata.json | 1 + apps/messageicons/metadata.json | 1 + apps/messages/metadata.json | 6 +++++- apps/sched/metadata.json | 2 ++ apps/widalarm/ChangeLog | 1 + apps/widalarm/app.png | Bin 0 -> 6229 bytes apps/widalarm/metadata.json | 15 +++++++++++++++ apps/{alarm => widalarm}/widget.js | 0 apps/widalarmeta/metadata.json | 1 + apps/widbat/metadata.json | 2 ++ apps/widbata/metadata.json | 1 + apps/widbatpc/metadata.json | 1 + apps/widbatv/metadata.json | 1 + apps/widbt/metadata.json | 2 ++ apps/widbt_notify/metadata.json | 3 ++- apps/widbthide/metadata.json | 1 + apps/widmessages/metadata.json | 2 ++ bin/sanitycheck.js | 6 +++--- core | 2 +- defaultapps_banglejs2.json | 2 +- 24 files changed, 53 insertions(+), 14 deletions(-) create mode 100644 apps/widalarm/ChangeLog create mode 100644 apps/widalarm/app.png create mode 100644 apps/widalarm/metadata.json rename apps/{alarm => widalarm}/widget.js (100%) diff --git a/README.md b/README.md index 1058787bb..fed13a358 100644 --- a/README.md +++ b/README.md @@ -282,8 +282,11 @@ and which gives information about the app for the Launcher. "dependencies" : { "notify":"type" } // optional, app 'types' we depend on (see "type" above) "dependencies" : { "messages":"app" } // optional, depend on a specific app ID // for instance this will use notify/notifyfs is they exist, or will pull in 'notify' - "dependencies" : { "messageicons":"module" } // optional, depend on a specific library to be used with 'require' + "dependencies" : { "messageicons":"module" } // optional, depend on a specific library to be used with 'require' - see provides_modules + "dependencies" : { "message":"widget" } // optional, depend on a specific type of widget - see provides_widgets "provides_modules" : ["messageicons"] // optional, this app provides a module that can be used with 'require' + "provides_widgets" : ["battery"] // optional, this app provides a type of widget - 'alarm/battery/bluetooth/pedometer/message' + "default" : true, // set if an app is the default implementer of something (a widget/module/etc) "readme": "README.md", // if supplied, a link to a markdown-style text file // that contains more information about this app (usage, etc) // A 'Read more...' link will be added under the app diff --git a/apps/alarm/ChangeLog b/apps/alarm/ChangeLog index 6ce6147ca..9994d33d9 100644 --- a/apps/alarm/ChangeLog +++ b/apps/alarm/ChangeLog @@ -36,4 +36,4 @@ 0.33: Allow hiding timers&alarms 0.34: Add "Confirm" option to alarm/timer edit menus 0.35: Add automatic translation of more strings - +0.36: alarm widget moved out of app diff --git a/apps/alarm/metadata.json b/apps/alarm/metadata.json index a02985851..dbf090774 100644 --- a/apps/alarm/metadata.json +++ b/apps/alarm/metadata.json @@ -2,17 +2,16 @@ "id": "alarm", "name": "Alarms & Timers", "shortName": "Alarms", - "version": "0.35", + "version": "0.36", "description": "Set alarms and timers on your Bangle", "icon": "app.png", - "tags": "tool,alarm,widget", + "tags": "tool,alarm", "supports": [ "BANGLEJS", "BANGLEJS2" ], "readme": "README.md", - "dependencies": { "scheduler":"type" }, + "dependencies": { "scheduler":"type", "alarm":"widget" }, "storage": [ { "name": "alarm.app.js", "url": "app.js" }, - { "name": "alarm.img", "url": "app-icon.js", "evaluate": true }, - { "name": "alarm.wid.js", "url": "widget.js" } + { "name": "alarm.img", "url": "app-icon.js", "evaluate": true } ], "screenshots": [ { "url": "screenshot-1.png" }, diff --git a/apps/launch/metadata.json b/apps/launch/metadata.json index 4d0270e37..85fcdd02f 100644 --- a/apps/launch/metadata.json +++ b/apps/launch/metadata.json @@ -7,6 +7,7 @@ "readme": "README.md", "icon": "app.png", "type": "launch", + "default": true, "tags": "tool,system,launcher", "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ diff --git a/apps/messagegui/metadata.json b/apps/messagegui/metadata.json index b3e70d5d4..f3798f645 100644 --- a/apps/messagegui/metadata.json +++ b/apps/messagegui/metadata.json @@ -9,6 +9,7 @@ "supports": ["BANGLEJS","BANGLEJS2"], "dependencies" : { "messageicons":"module" }, "provides_modules": ["messagegui"], + "default": true, "readme": "README.md", "storage": [ {"name":"messagegui","url":"lib.js"}, diff --git a/apps/messageicons/metadata.json b/apps/messageicons/metadata.json index b6ce34f88..b621c55b9 100644 --- a/apps/messageicons/metadata.json +++ b/apps/messageicons/metadata.json @@ -8,6 +8,7 @@ "tags": "tool,system", "supports": ["BANGLEJS","BANGLEJS2"], "provides_modules" : ["messageicons"], + "default": true, "storage": [ {"name":"messageicons","url":"lib.js"} ] diff --git a/apps/messages/metadata.json b/apps/messages/metadata.json index 8bcf3da25..27e771975 100644 --- a/apps/messages/metadata.json +++ b/apps/messages/metadata.json @@ -8,7 +8,11 @@ "tags": "tool,system", "supports": ["BANGLEJS","BANGLEJS2"], "provides_modules" : ["messages"], - "dependencies" : { "messagegui":"module","messagewidget":"module" }, + "dependencies" : { + "messagegui":"module", + "message":"widget" + }, + "default": true, "readme": "README.md", "storage": [ {"name":"messages","url":"lib.js"}, diff --git a/apps/sched/metadata.json b/apps/sched/metadata.json index a457d0f44..a266d11f8 100644 --- a/apps/sched/metadata.json +++ b/apps/sched/metadata.json @@ -7,6 +7,8 @@ "type": "scheduler", "tags": "tool,system,alarm", "supports": ["BANGLEJS","BANGLEJS2"], + "provides_modules" : ["sched"], + "default" : true, "readme": "README.md", "storage": [ {"name":"sched.boot.js","url":"boot.js"}, diff --git a/apps/widalarm/ChangeLog b/apps/widalarm/ChangeLog new file mode 100644 index 000000000..63568a9bd --- /dev/null +++ b/apps/widalarm/ChangeLog @@ -0,0 +1 @@ +0.01: Moved out of 'alarm' app diff --git a/apps/widalarm/app.png b/apps/widalarm/app.png new file mode 100644 index 0000000000000000000000000000000000000000..a859dd2ef1768b0b260b996ef41920607c080913 GIT binary patch literal 6229 zcmeHKc{r497ay`0*-B&?BT~$2_KYRO6tb4BH?us$V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L5ZAi97yt&$|O*pWZ%gfe`kB z2ntnA z-ZU%=jzJT!I2M2GN$Py&Lj95rjmYnxfMi0N*TN{Sw>X1OC=|4 z8n-v~!u8r(wex}G>5zjlSO0QjsCLe_RqOqC{TpFg-8ldN literal 0 HcmV?d00001 diff --git a/apps/widalarm/metadata.json b/apps/widalarm/metadata.json new file mode 100644 index 000000000..b91457138 --- /dev/null +++ b/apps/widalarm/metadata.json @@ -0,0 +1,15 @@ +{ + "id": "widalarm", + "name": "Alarms Widget", + "version": "0.01", + "description": "Displays an alarm icon in the widgets bar if any alarm is active", + "icon": "app.png", + "type": "widget", + "tags": "tool,alarm,widget", + "supports": [ "BANGLEJS", "BANGLEJS2" ], + "provides_widgets" : ["alarm"], + "default" : true, + "storage": [ + { "name": "widalarm.wid.js", "url": "widget.js" } + ] +} diff --git a/apps/alarm/widget.js b/apps/widalarm/widget.js similarity index 100% rename from apps/alarm/widget.js rename to apps/widalarm/widget.js diff --git a/apps/widalarmeta/metadata.json b/apps/widalarmeta/metadata.json index b6d8bd62b..ef9f55ba8 100644 --- a/apps/widalarmeta/metadata.json +++ b/apps/widalarmeta/metadata.json @@ -8,6 +8,7 @@ "type": "widget", "tags": "widget", "supports": ["BANGLEJS","BANGLEJS2"], + "provides_widgets" : ["alarm"], "screenshots" : [ { "url":"screenshot.png" } ], "storage": [ {"name":"widalarmeta.wid.js","url":"widget.js"} diff --git a/apps/widbat/metadata.json b/apps/widbat/metadata.json index 0f040396f..993310eb2 100644 --- a/apps/widbat/metadata.json +++ b/apps/widbat/metadata.json @@ -6,6 +6,8 @@ "icon": "widget.png", "type": "widget", "tags": "widget,battery", + "provides_widgets" : ["battery"], + "default" : true, "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ {"name":"widbat.wid.js","url":"widget.js"} diff --git a/apps/widbata/metadata.json b/apps/widbata/metadata.json index 26968a7d7..ddc901e80 100644 --- a/apps/widbata/metadata.json +++ b/apps/widbata/metadata.json @@ -10,6 +10,7 @@ "readme": "README.md", "description": "Shows the current battery level status in the top right using the clocks colour theme", "tags": "widget,battery", + "provides_widgets" : ["battery"], "storage": [ {"name":"widbata.wid.js","url":"widbata.wid.js"} ] diff --git a/apps/widbatpc/metadata.json b/apps/widbatpc/metadata.json index 7da4e3e0c..953f8d345 100644 --- a/apps/widbatpc/metadata.json +++ b/apps/widbatpc/metadata.json @@ -7,6 +7,7 @@ "icon": "widget.png", "type": "widget", "tags": "widget,battery", + "provides_widgets" : ["battery"], "supports": ["BANGLEJS","BANGLEJS2"], "readme": "README.md", "screenshots": [{"url":"widbatpc.full.jpg"},{"url":"widbatpc.part.jpg"}], diff --git a/apps/widbatv/metadata.json b/apps/widbatv/metadata.json index 37cf6197b..d4ef28315 100644 --- a/apps/widbatv/metadata.json +++ b/apps/widbatv/metadata.json @@ -6,6 +6,7 @@ "icon": "widget.png", "type": "widget", "tags": "widget,battery", + "provides_widgets" : ["battery"], "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ {"name":"widbatv.wid.js","url":"widget.js"} diff --git a/apps/widbt/metadata.json b/apps/widbt/metadata.json index e2d5082a5..1623db7a1 100644 --- a/apps/widbt/metadata.json +++ b/apps/widbt/metadata.json @@ -6,6 +6,8 @@ "icon": "widget.png", "type": "widget", "tags": "widget,bluetooth", + "provides_widgets" : ["bluetooth"], + "default" : true, "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ {"name":"widbt.wid.js","url":"widget.js"} diff --git a/apps/widbt_notify/metadata.json b/apps/widbt_notify/metadata.json index 36905a340..5e3f15af2 100644 --- a/apps/widbt_notify/metadata.json +++ b/apps/widbt_notify/metadata.json @@ -6,6 +6,7 @@ "icon": "widget.png", "type": "widget", "tags": "widget,bluetooth", + "provides_widgets" : ["bluetooth"], "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ {"name":"widbt_notify.wid.js","url":"widget.js"}, @@ -13,5 +14,5 @@ ], "data": [ {"name":"widbt_notify.json"} - ] + ] } diff --git a/apps/widbthide/metadata.json b/apps/widbthide/metadata.json index 59b13adb4..e3ac5cd54 100644 --- a/apps/widbthide/metadata.json +++ b/apps/widbthide/metadata.json @@ -6,6 +6,7 @@ "icon": "widget.png", "type": "widget", "tags": "widget,bluetooth", + "provides_widgets" : ["bluetooth"], "supports": ["BANGLEJS","BANGLEJS2"], "storage": [ {"name":"widbthide.wid.js","url":"widget.js"} diff --git a/apps/widmessages/metadata.json b/apps/widmessages/metadata.json index 0c3ac7e05..080e19273 100644 --- a/apps/widmessages/metadata.json +++ b/apps/widmessages/metadata.json @@ -10,6 +10,8 @@ "screenshots": [{"url": "screenshot.gif"}], "dependencies" : { "messageicons":"module" }, "provides_modules" : ["messagewidget"], + "provides_widgets" : ["message"], + "default" : true, "readme": "README.md", "storage": [ {"name":"messagewidget","url":"lib.js"}, diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js index 0a4765d9c..5af6f1aa1 100755 --- a/bin/sanitycheck.js +++ b/bin/sanitycheck.js @@ -76,7 +76,7 @@ const APP_KEYS = [ 'id', 'name', 'shortName', 'version', 'icon', 'screenshots', 'description', 'tags', 'type', 'sortorder', 'readme', 'custom', 'customConnect', 'interface', 'storage', 'data', 'supports', 'allow_emulator', - 'dependencies', 'provides_modules' + 'dependencies', 'provides_modules', 'provides_widgets', "default" ]; const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite']; const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate']; @@ -168,8 +168,8 @@ apps.forEach((app,appIdx) => { if (app.dependencies) { if (("object"==typeof app.dependencies) && !Array.isArray(app.dependencies)) { Object.keys(app.dependencies).forEach(dependency => { - if (!["type","app","module"].includes(app.dependencies[dependency])) - ERROR(`App ${app.id} 'dependencies' must all be tagged 'type/app/module' right now`, {file:metadataFile}); + if (!["type","app","module","widget"].includes(app.dependencies[dependency])) + ERROR(`App ${app.id} 'dependencies' must all be tagged 'type/app/module/widget' right now`, {file:metadataFile}); if (app.dependencies[dependency]=="type" && !METADATA_TYPES.includes(dependency)) ERROR(`App ${app.id} 'type' dependency must be one of `+METADATA_TYPES, {file:metadataFile}); }); diff --git a/core b/core index 3a953179b..2a89ea64f 160000 --- a/core +++ b/core @@ -1 +1 @@ -Subproject commit 3a953179b7bb9f574d4e77d5f34b6b7deee1e884 +Subproject commit 2a89ea64f7874b9264572f68836fe8ecd0a6b191 diff --git a/defaultapps_banglejs2.json b/defaultapps_banglejs2.json index 04bd44504..f96f81f60 100644 --- a/defaultapps_banglejs2.json +++ b/defaultapps_banglejs2.json @@ -1 +1 @@ -["boot","launch","antonclk","health","setting","about","widbat","widbt","widlock","widid"] +["boot","launch","antonclk","health","setting","about","alarm","widbat","widbt","widlock","widid"]