From c4e1fd01be4258fa97569834bbf0f959427ed3f5 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Mon, 21 Nov 2022 16:37:04 +0000 Subject: [PATCH] Added clkinfosunrise to allow clocks to display sunrise and sunset if they use clock_info --- README.md | 14 +++++++++++-- apps/agenda/metadata.json | 2 +- apps/aptsciclk/metadata.json | 1 + apps/aptsciclk/screenshot.png | Bin 0 -> 5510 bytes apps/bwclk/metadata.json | 2 +- apps/clkinfosunrise/ChangeLog | 1 + apps/clkinfosunrise/app.png | Bin 0 -> 661 bytes apps/clkinfosunrise/clkinfo.js | 33 ++++++++++++++++++++++++++++++ apps/clkinfosunrise/metadata.json | 12 +++++++++++ apps/ha/metadata.json | 2 +- apps/smpltmr/metadata.json | 2 +- apps/weather/metadata.json | 2 +- bin/sanitycheck.js | 2 +- modules/clock_info.js | 15 ++++++++------ 14 files changed, 74 insertions(+), 14 deletions(-) create mode 100644 apps/aptsciclk/screenshot.png create mode 100644 apps/clkinfosunrise/ChangeLog create mode 100644 apps/clkinfosunrise/app.png create mode 100644 apps/clkinfosunrise/clkinfo.js create mode 100644 apps/clkinfosunrise/metadata.json diff --git a/README.md b/README.md index c54dc99f1..1058787bb 100644 --- a/README.md +++ b/README.md @@ -255,8 +255,11 @@ and which gives information about the app for the Launcher. // 'app' - an application // 'clock' - a clock - required for clocks to automatically start // 'widget' - a widget + // 'module' - this provides a module that can be used with 'require'. + // 'provides_modules' should be used if type:module is specified // 'bootloader' - an app that at startup (app.boot.js) but doesn't have a launcher entry for 'app.js' // 'settings' - apps that appear in Settings->Apps (with appname.settings.js) but that have no 'app.js' + // 'clkinfo' - Provides a 'myapp.clkinfo.js' file that can be used to display info in clocks - see modules/clock_info.js // 'RAM' - code that runs and doesn't upload anything to storage // 'launch' - replacement 'Launcher' // 'textinput' - provides a 'textinput' library that allows text to be input on the Bangle @@ -265,9 +268,16 @@ and which gives information about the app for the Launcher. // 'notify' - provides 'notify' library for showing notifications // 'locale' - provides 'locale' library for language-specific date/distance/etc // (a version of 'locale' is included in the firmware) - // 'module' - this provides a module that can be used with 'require'. - // 'provides_modules' should be used if type:module is specified "tags": "", // comma separated tag list for searching + // common types are: + // 'clock' - it's a clock + // 'widget' - it is (or provides) a widget + // 'outdoors' - useful for outdoor activities + // 'tool' - a useful utility (timer, calculator, etc) + // 'game' - a game + // 'bluetooth' - uses Bluetooth LE + // 'system' - used by the system + // 'clkinfo' - provides or uses clock_info module for data on your clock face (see modules/clock_info.js) "supports": ["BANGLEJS2"], // List of device IDs supported, either BANGLEJS or BANGLEJS2 "dependencies" : { "notify":"type" } // optional, app 'types' we depend on (see "type" above) "dependencies" : { "messages":"app" } // optional, depend on a specific app ID diff --git a/apps/agenda/metadata.json b/apps/agenda/metadata.json index 6d91455f0..4436e143c 100644 --- a/apps/agenda/metadata.json +++ b/apps/agenda/metadata.json @@ -5,7 +5,7 @@ "description": "Simple agenda", "icon": "agenda.png", "screenshots": [{"url":"screenshot_agenda_overview.png"}, {"url":"screenshot_agenda_event1.png"}, {"url":"screenshot_agenda_event2.png"}], - "tags": "agenda", + "tags": "agenda,clkinfo", "supports": ["BANGLEJS","BANGLEJS2"], "readme": "README.md", "allow_emulator": true, diff --git a/apps/aptsciclk/metadata.json b/apps/aptsciclk/metadata.json index c450d926e..77e40f843 100644 --- a/apps/aptsciclk/metadata.json +++ b/apps/aptsciclk/metadata.json @@ -5,6 +5,7 @@ "version": "0.08", "description": "A clock based on the portal series", "icon": "app.png", + "screenshots": [{"url":"screenshot.png"}], "type": "clock", "tags": "clock", "supports": ["BANGLEJS2"], diff --git a/apps/aptsciclk/screenshot.png b/apps/aptsciclk/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..4803e4b1372a99e9c8b8a8acc185f0fb1b6684ec GIT binary patch literal 5510 zcmV;16?y83P)Px~KuJVFRCr$PUFo{5s1EG?{ttcnb3kLv2m#TR`=ig@ONJ1Nq6naW|Ni~^_h0@m zJ@8Tw{3U>2+H(WU{`>p8)iN93C4dJ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H=CDV_lER~Xm> zUb#o{w)FLqre~lJ)4<~(D%bP`fPa;Nd-pl1fqPdvOZjnZqHxWAx@%N@t^R$BolvG+ zBt)wN-jaV*M}0L4F+)FJ73deK|G2V5fm#*3O)3a7qOZh51Z7sdE4yH8dB$hJ?zY6e*Y)1 zv;PDX3Weg>a^9`nE0!vEzvbD@zZ;0V30r`CbXJytFJ(2^UAjxc4#N)srat3F3?v)?*_w)FLE^_i^P*iNBh zsUi;Ef4QBFB}?ivFbtHyuo-y)#j!@XIAV>*!>%I~&EiG#icKPxmy2+5(0FuY_=&d6 zL)lr<1-ca9Lb`-hfj-5zkSZ~dfLKHHUlko~Ie1+o|00vtmjhs#VCP`sG-Okdw*2w> z9#ra3-i7U5*!wLlQjUP3!?X=EQ;;y)=d&sQvUBjO0Uy7^r!q9W$kEXSk``Q>h4FyD z6cYwqEI|GYy!in2pONCDJp(BVZd?jp{6S8hfW>)#j|hYpFm(T$k5WL&f~&Kjhc6@i zC#NUjl!QMR#xwr&6OzCJ!o}IYu}qkm3?16Wg(-i}R@MN$Qy_u1H>{oOeA ({ text : sunrise, + img : atob("GBiBAAAAAAAAAAAAAAAYAAA8AAB+AAD/AAAAAAAAAAAAAAAYAAAYAAQYIA4AcAYAYAA8AAB+AAD/AAH/gD///D///AAAAAAAAAAAAA==") }), + show : calculate, hide : () => {} + }, { name : "Sunset", + get : () => ({ text : sunset, + img : atob("GBiBAAAAAAAAAAAAAAB+AAA8AAAYAAAYAAAAAAAAAAAAAAAYAAAYAAQYIA4AcAYAYAA8AAB+AAD/AAH/gD///D///AAAAAAAAAAAAA==") }), + show : calculate, hide : () => {} + } + ] + }; +}) diff --git a/apps/clkinfosunrise/metadata.json b/apps/clkinfosunrise/metadata.json new file mode 100644 index 000000000..f8b68e11f --- /dev/null +++ b/apps/clkinfosunrise/metadata.json @@ -0,0 +1,12 @@ +{ "id": "clkinfosunrise", + "name": "Sunrise Clockinfo", + "version":"0.01", + "description": "For clocks that display 'clockinfo' (messages that can be cycled through using the clock_info module) this displays sunrise and sunset based on the location from the 'My Location' app", + "icon": "app.png", + "type": "clkinfo", + "tags": "clkinfo,sunrise", + "supports" : ["BANGLEJS2"], + "storage": [ + {"name":"sunrise.clkinfo.js","url":"clkinfo.js"} + ] +} diff --git a/apps/ha/metadata.json b/apps/ha/metadata.json index 052e82fe0..fad052544 100644 --- a/apps/ha/metadata.json +++ b/apps/ha/metadata.json @@ -5,7 +5,7 @@ "description": "Integrates your BangleJS into HomeAssistant.", "icon": "ha.png", "type": "app", - "tags": "tool", + "tags": "tool,clkinfo", "readme": "README.md", "supports": ["BANGLEJS2"], "custom": "custom.html", diff --git a/apps/smpltmr/metadata.json b/apps/smpltmr/metadata.json index 5f1329dfc..ce526d1ba 100644 --- a/apps/smpltmr/metadata.json +++ b/apps/smpltmr/metadata.json @@ -5,7 +5,7 @@ "version": "0.04", "description": "A very simple app to start a timer.", "icon": "app.png", - "tags": "tool,alarm,timer", + "tags": "tool,alarm,timer,clkinfo", "dependencies": {"scheduler":"type"}, "supports": ["BANGLEJS2"], "screenshots": [{"url":"screenshot_1.png"}, {"url": "screenshot_2.png"}, {"url": "screenshot_3.png"}, {"url": "screenshot_4.png"}], diff --git a/apps/weather/metadata.json b/apps/weather/metadata.json index 125041ec4..e28a282d6 100644 --- a/apps/weather/metadata.json +++ b/apps/weather/metadata.json @@ -5,7 +5,7 @@ "description": "Show Gadgetbridge weather report", "icon": "icon.png", "screenshots": [{"url":"screenshot.png"}], - "tags": "widget,outdoors", + "tags": "widget,outdoors,clkinfo", "supports": ["BANGLEJS","BANGLEJS2"], "readme": "readme.md", "storage": [ diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js index 9ed699007..7ee07bebc 100755 --- a/bin/sanitycheck.js +++ b/bin/sanitycheck.js @@ -81,7 +81,7 @@ const APP_KEYS = [ const STORAGE_KEYS = ['name', 'url', 'content', 'evaluate', 'noOverwite', 'supports', 'noOverwrite']; const DATA_KEYS = ['name', 'wildcard', 'storageFile', 'url', 'content', 'evaluate']; const SUPPORTS_DEVICES = ["BANGLEJS","BANGLEJS2"]; // device IDs allowed for 'supports' -const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","waypoints","textinput","module"]; // values allowed for "type" field +const METADATA_TYPES = ["app","clock","widget","bootloader","RAM","launch","scheduler","notify","locale","settings","waypoints","textinput","module","clkinfo"]; // values allowed for "type" field const FORBIDDEN_FILE_NAME_CHARS = /[,;]/; // used as separators in appid.info const VALID_DUPLICATES = [ '.tfmodel', '.tfnames' ]; const GRANDFATHERED_ICONS = ["s7clk", "snek", "astral", "alpinenav", "slomoclock", "arrow", "pebble", "rebble"]; diff --git a/modules/clock_info.js b/modules/clock_info.js index bf1967276..1e54db26c 100644 --- a/modules/clock_info.js +++ b/modules/clock_info.js @@ -129,13 +129,16 @@ Simply supply the menu data (from .load) and a function to draw the clock info. For example: -var clockInfoMenu = require("clock_info").addInteractive(require("clock_info").load(), (itm, info) => { - var y = 0; - g.reset().setFont("6x8:2").setFontAlign(-1,0); - g.clearRect(0,y,g.getWidth(),y+23); - g.drawImage(info.img, 0,y); - g.drawString(info.text, 48,y+12); +let clockInfoMenu = require("clock_info").addInteractive(require("clock_info").load(), (itm, info) => { + var x = 20, y = 20, w=80, h=48; + g.reset().clearRect(x,y,x+w-1,y+h-1); + g.drawRect(x,y,x+w-1,y+h-1); // debug - just to show where we are + g.drawImage(info.img, x+w/2-12,y+4); + g.setFont("6x8:2").setFontAlign(0,0).drawString(info.text, x+w/2,y+36); }); +// then when clock 'unloads': +clockInfoMenu.remove(); +delete clockInfoMenu; Then if you need to unload the clock info so it no longer uses memory or responds to swipes, you can call clockInfoMenu.remove()