From eb564d20a442a1da4bee764e1bac93b60211d40b Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Tue, 7 Dec 2021 14:12:33 +0100 Subject: [PATCH 01/94] ios 0.05: Added more bundleId's (app-id's which can be used to determine a friendly app name in the notifications) locale 0.12: Fixed nl_NL formatting, because the full months won't fit on the Bangle.js2's screen --- apps.json | 4 ++-- apps/ios/ChangeLog | 2 ++ apps/ios/boot.js | 19 +++++++++++++++++-- apps/locale/ChangeLog | 1 + apps/locale/locales.js | 2 +- 5 files changed, 23 insertions(+), 5 deletions(-) diff --git a/apps.json b/apps.json index bf69480ff..9905a0cdc 100644 --- a/apps.json +++ b/apps.json @@ -95,7 +95,7 @@ { "id": "ios", "name": "iOS Integration", - "version": "0.04", + "version": "0.05", "description": "(BETA) App to display notifications from iOS devices", "icon": "app.png", "tags": "tool,system,ios,apple,messages,notifications", @@ -197,7 +197,7 @@ { "id": "locale", "name": "Languages", - "version": "0.11", + "version": "0.12", "description": "Translations for different countries", "icon": "locale.png", "type": "locale", diff --git a/apps/ios/ChangeLog b/apps/ios/ChangeLog index dd8a3549b..5bafc4d98 100644 --- a/apps/ios/ChangeLog +++ b/apps/ios/ChangeLog @@ -2,3 +2,5 @@ 0.02: Remove messages on disconnect 0.03: Handling of message actions (ok/clear) 0.04: Added common bundleId's +0.05: Added more bundleId's (app-id's which can be used to + determine a friendly app name in the notifications) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 875f00067..33eb8261c 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -54,25 +54,40 @@ E.on('notify',msg=>{ "name" : string, */ var appNames = { - "nl.ah.Appie": "Albert Heijn", + "com.apple.facetime": "FaceTime", "com.apple.mobilecal": "Calendar", "com.apple.mobilemail": "Mail", + "com.apple.Passbook": "iOS Wallet", "com.apple.reminders": "Reminders", "com.apple.shortcuts": "Shortcuts", "com.atebits.Tweetie2": "Twitter", "com.burbn.instagram" : "Instagram", "com.facebook.Facebook": "Facebook", "com.facebook.Messenger": "FB Messenger", + "com.google.Chromecast" : "Google Home", "com.google.Gmail" : "GMail", "com.google.hangouts" : "Hangouts", "com.google.ios.youtube" : "YouTube", + "com.hammerandchisel.discord" : "Discord", + "com.ifttt.ifttt" : "IFTTT", "com.jumbo.app" : "Jumbo", + "com.linkedin.LinkedIn" : "LinkedIn", + "com.nestlabs.jasper.release" : "Nest", "com.netflix.Netflix" : "Netflix", + "com.reddit.Reddit" : "Reddit", "com.skype.skype": "Skype", "com.skype.SkypeForiPad": "Skype", "com.spotify.client": "Spotify", - "net.whatsapp.WhatsApp": "WhatsApp", + "com.tinyspeck.chatlyio": "Slack", + "com.toyopagroup.picaboo": "Snapchat", + "com.ubercab.UberClient": "Uber", + "com.ubercab.UberEats": "UberEats", "com.wordfeud.free": "WordFeud", + "com.zhiliaoapp.musically": "TikTok", + "net.whatsapp.WhatsApp": "WhatsApp", + "nl.ah.Appie": "Albert Heijn", + "nl.postnl.postnl": "PostNL", + "ph.telegra.Telegraph": "Telegram", // could also use NRF.ancsGetAppInfo(msg.appId) here }; diff --git a/apps/locale/ChangeLog b/apps/locale/ChangeLog index ec74955e9..ac4352f33 100644 --- a/apps/locale/ChangeLog +++ b/apps/locale/ChangeLog @@ -11,3 +11,4 @@ 0.09: Added New Zealand en_NZ 0.10: Apply 12hour setting to time 0.11: Added translations for nl_NL and changes one formatting +0.12: Fixed nl_NL formatting, because the full months won't fit on the Bangle.js2's screen diff --git a/apps/locale/locales.js b/apps/locale/locales.js index e076b70bd..2e29eb82a 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -184,7 +184,7 @@ var locales = { temperature: "°C", ampm: { 0: "", 1: "" }, timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" }, - datePattern: { 0: "%B %d %Y", 1: "%d.%m.%y" }, // zondag 1 maart 2020 // 01.01.20 + datePattern: { 0: "%d %b %Y", 1: "%d-%m-%Y" }, // 28 feb 2020 // 28-02-2020 abday: "zo,ma,di,wo,do,vr,za", day: "zondag,maandag,dinsdag,woensdag,donderdag,vrijdag,zaterdag", abmonth: "jan,feb,mrt,apr,mei,jun,jul,aug,sep,okt,nov,dec", From d3d6a845ff1fdf41545ceeba487d03ddd7deeebc Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 17:48:39 +0000 Subject: [PATCH 02/94] Added scribble app, icon and params. --- apps/scribble/ChangeLog | 1 + apps/scribble/README.md | 25 ++ apps/scribble/add_to_apps.json | 14 + apps/scribble/app-icon.js | 1 + apps/scribble/app.png | Bin 0 -> 1162 bytes apps/scribble/scribble.js | 469 +++++++++++++++++++++++++++++++++ 6 files changed, 510 insertions(+) create mode 100644 apps/scribble/ChangeLog create mode 100644 apps/scribble/README.md create mode 100644 apps/scribble/add_to_apps.json create mode 100644 apps/scribble/app-icon.js create mode 100644 apps/scribble/app.png create mode 100644 apps/scribble/scribble.js diff --git a/apps/scribble/ChangeLog b/apps/scribble/ChangeLog new file mode 100644 index 000000000..af7f83942 --- /dev/null +++ b/apps/scribble/ChangeLog @@ -0,0 +1 @@ +0.01: Initial release diff --git a/apps/scribble/README.md b/apps/scribble/README.md new file mode 100644 index 000000000..dc139bc9a --- /dev/null +++ b/apps/scribble/README.md @@ -0,0 +1,25 @@ +# App Name + +Describe the app... + +Add screen shots (if possible) to the app folder and link then into this file with ![](.png) + +## Usage + +Describe how to use it + +## Features + +Name the function + +## Controls + +Name the buttons and what they are used for + +## Requests + +Name who should be contacted for support/update requests + +## Creator + +Your name diff --git a/apps/scribble/add_to_apps.json b/apps/scribble/add_to_apps.json new file mode 100644 index 000000000..054f35d55 --- /dev/null +++ b/apps/scribble/add_to_apps.json @@ -0,0 +1,14 @@ +{ "id": "scribble", + "name": "Scribble", + "shortName":"Scribble", + "version":"0.01", + "description": "A keyboard on your wrist!", + "icon": "app.png", + "tags": "keyboard, text, scribble", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"scribble.app.js","url":"app.js"}, + {"name":"scribble.img","url":"app-icon.js","evaluate":true} + ] +} diff --git a/apps/scribble/app-icon.js b/apps/scribble/app-icon.js new file mode 100644 index 000000000..b77fc9a4f --- /dev/null +++ b/apps/scribble/app-icon.js @@ -0,0 +1 @@ +var img = require("heatshrink").decompress(atob("mEwwMB/4A2/IFE+IFE+YFE84FE44FE54SEz/jAocfDAk/54EC/1/x4FC/l/z4FDCQJGD/wFD+IYBIwYSBIwf4IwhfEIwuPIwkPIwMAj//g/P/gFCkOP/AEB/8wj5+Dn0/Aoc8n/4JAU4v/8gYFBaYWAJ4MHAoPwEgMPOgUfLogJCBYQFE+AFD8BHB/EAAAV/AoYyCB4IKBc6QA==")) \ No newline at end of file diff --git a/apps/scribble/app.png b/apps/scribble/app.png new file mode 100644 index 0000000000000000000000000000000000000000..01a6acb72d8d7fe7774e993726f28dd5d6b20927 GIT binary patch literal 1162 zcmV;51aPx#1ZP1_K>z@;j|==^1poj532;bRa{vGi!vFvd!vV){sAK>D1RqI6K~!i%?U`w) zjd>i$@7N7vUk9Zu#grvt#yWXLwnSM{2u&el5?;v*qIrQNioy$qY#EW1t(2*;lx;Bf zE&CWVCj0jJxaXOU<9W_;?!Cw3=6vhZIrrRqp6B`f{=e=2zXf^al~-PQeby?Qcr8iQ zgdd<9+=Hi3YE%h^!yoV)d=EKQnZ#>J=nH5LL!llVNKk6@70iGKum@^EsZwXS4i}&= zMCF%;)_{^+{bH*T?1H;67wSNm%E2gbrP}+!r=aRE5%m0a=m_RRs`PkII1Z;^AjGbU zFaS=&N$3Yrq4PCt0?X}G-?`{;8)=rh&>0a`9Hx!_#JFu zVbW0h!9n;7MnGkVU0uLfHui@=lt&GfrEmw9Ky8R!4PXQKQ1cT%hsn?x2CmRH_zq&1 zb=-LV8}@-K5mt5ltPLE2D`4mtcCpGNHJ;DIO|X1MRh_D^5nh0+<#-XhY*;?jGguE5 zAWRzdBN$>D+YM}DvC8G20zTAXXbDlF(*yQ{VKxa|jo76ZErpk0G^A@-i$OzeSoI-x zSqhiKZLlP!t2!p@MK}f~c;YAv$eII>;5nRw@sPS%(NOonH{eg`15p(!kl%4Soef*T zu5Qx5PD9qR^sNQG@55gMW7`Q-@46a#>s#0j4s|oZ5j&mS6L_t#hfK$N%Cy8*lzGq# zmVx;&0SqbY`%X9uy?23ak#^EEmgdGMiiO+H_E|A?Df7kkvlg3tA&HlE-B%R^ePVQ=s=e`oF(!~TOq`8QT7 z2f$#u4Bop%wOK|Th$U+W*gP#N8I` 200 ? 2 : 1; +const rowN = 7; +const colN = 7; +const headerH = maxY / 7; +const rowH = (maxY - headerH) / rowN; +const colW = maxX / colN; + +function getRndInteger(min, max) { + return Math.floor(Math.random() * (max - min)) + min; +} + +class Window { + constructor(label, bgCol) { + this.label = "win_" + this.label += (typeof label !== "undefined") ? label : "Unset"; + console.log(`Constructing Window ${this.label}, args: ${arguments}`) + + this.bgCol = bgCol; + this.layers = []; + } + + push(layer) { + layer.label=`${this.layers.length}_${layer.label}`; + this.layers.push(layer); + } + pop() { + this.layers.pop(); + } + + top_layer() { + return this.layers[this.layers.length - 1]; + } + + render() { + + if (this.bgCol !== transp) { + console.log(`${this.label}: filling bg in ${this.bgCol}`); + g.setColor(this.bgCol); + g.fillRect(0, 0, g.getWidth(), g.getHeight()); + } + + + let i = 0; + this.layers.forEach((lyr) => { + // console.log(`Rendering Layer ${i} ${lyr.label}`) + i++; + lyr.render(); + }); + } +} + +class Layer { + constructor(label) { + + this.label = "lyr_" + + this.label += (typeof label !== "undefined") ? label : "Unset"; + console.log(`Constructing Layer ${this.label}, args: ${arguments}`) + this.items = []; + // console.log(`bg is ${bg} type ${typeof bg}`) + + } + + push(button) { + this.items.push(button); + } + + setLabel(label) { + this.label = label; + } + + parseTaps(xy) { + this.items.forEach(item => { + // // print(item) + if (item.was_tapped(xy)) { + // pass parent layer to the tapped button + item.callback(this); + } + }); + } + + render() { + + this.items.forEach((item) => { + + item.render(); + }); + } +} + +class BTN_layer extends Layer { + + constructor(label, layout) { + + Layer.call(this, label) + + this.alphabet = (uppercase) ? abc.toUpperCase() : abc; + console.log(`Constructing BTN_Layer ${this.label}, layout ${this.layout}`) + + if (layout in points) { + + this.create_layout(layout); + + } + else { + throw `Invalid layout passed ->[${layout}]`; + } + + // // print(this); + + } + + render() { + + Layer.prototype.render.call(this); + } + + create_layout(layout) { + + console.log(`Creating layout ${layout}`); + + let start_p = 0; + + this.items = this.push_buttons(points[layout], this.alphabet, start_p, chunk_size) + + } + + push_buttons(points, in_string, start_p) { + + items = []; + spacer = "" // char interposed b/w the two halves of text per button + + for (let i = 0; i < points.length; i++) { + substr = `${in_string.substring( + start_p, + start_p + chunk_size / 2 + )}${spacer}${in_string.substring(start_p + chunk_size / 2, start_p + chunk_size)}`; + + btn_label = + uppercase === 1 + ? substr.toUpperCase() + : substr; + + start_p += chunk_size; + + items.push( + new Button( + i, // ID of button + points[i].x, // left + points[i].y, // top + btn_label, // text to render in the button + box_size.w, // width + box_size.h, // height + g.theme.bg, // box bg + white, // box fill + black // text col + ) + ); + } + + return items; + } + + update_labels(in_string, start_p, chk_size) { + // print(`Updating labels | in_string ${in_string} start_p ${start_p} chk_size ${chk_size}`); + in_string.replace('\n', ''); // remove newlines just in case + + spacer = "" // char interposed b/w the two halves of text per button + + for (let i = 0; i < this.items.length; i++) { + + item = this.items[i]; + substr = (chk_size < 3) + ? in_string.substring(start_p + chk_size * i, start_p + (chk_size * (i + 1))) + : `${in_string.substring( + start_p + chk_size * i, + start_p + chk_size * i + chk_size / 2 + )}${spacer}${in_string.substring(start_p + chk_size * i + chk_size / 2, start_p + chk_size * i + chk_size)}`; + // // print(`(chk_size > 3): ${(chk_size > 3)}`) + // print(`Label ${i} -> ${substr}`); + item.setLabel(substr); + } + + } + + zoom_in(id) { + let start_p = id * chunk_size; + // print(`Zooming in | start_p ${start_p}`) + if (chunk_size % this.items.length !== 0) { + throw `Chunk size [${chunk_size}] does not fit #btns [${this.items.length}]` + } + subchunk_size = chunk_size / this.items.length; + + substr = this.alphabet.substring(start_p, start_p + chunk_size); + // print(`substr ${substr}`); + // print(`subchunk_size ${subchunk_size}`); + this.update_labels(substr, 0, subchunk_size); + + } + +} + +class Button { + constructor(id, x, y, text, w, h, col, bgCol, txtCol, font) { + this.id = id; + this.label = `btn_${this.id}`; + + this.text = text; + this.x1 = x; + this.y1 = y; + this.w = w; + this.h = h; + this.col = typeof col !== "undefined" ? col : black; + this.bgCol = typeof bgCol !== "undefined" ? bgCol : gray2; + this.txtCol = typeof txtCol !== "undefined" ? txtCol : black; + // this.font = font; + + this.x2 = this.x1 + this.w; + this.y2 = this.y1 + this.h; + this.center = { + x: (this.x1 + this.x2) / 2, + y: (this.y1 + this.y2) / 2, + }; + + + console.log(`Constructed button `) + // // print(this); + } + + render() { + // console.log( + // `Button ${this.text} -> P1: (${this.x1}, ${this.y1}) | P2: (${this.x2}, ${this.y2})` + // ); + + g.setColor(this.bgCol); + g.fillRect(this.x1, this.y1, this.x2, this.y2); + g.setColor(this.col); + g.drawRect(this.x1, this.y1, this.x2, this.y2); + g.setColor(this.txtCol); + + g.setFontAlign(0, 0).setFont(global_font, font_height); + g.drawString(this.text, this.center.x, this.center.y); + } + + // short tap callback func + callback(parent_layer) { + // print(`Tapped button ${this.id}`); + + // this.highlight(); // TODO set up highlighting + if (last_layer) { + l_text.items[0].text += this.text; + // print(`Updated buffer to ${l_text.items[0].text}`) + parent_layer.update_labels(parent_layer.alphabet, 0, chunk_size); + last_layer = false; + } + else { + parent_layer.zoom_in(this.id); + last_layer = true; + } + } + + was_tapped(xy) { + var x = xy.x; + var y = xy.y; + + if ((x > this.x1 && x < this.x2) && (y > this.y1 && y < this.y2)) { + return true; + } + else { + return false; + } + } + + setLabel(lbl) { + // // print(`Button ${this.id}, updating label ${this.text} with ${lbl}`); + this.text = lbl; + } + + getLabel(lbl) { + + return this.label; + } + + highlight() { + + g.setColor(g.theme.bgH); + g.fillRect(this.x1, this.y1, this.x2, this.y2); + g.setColor(g.theme.fgH); + g.drawRect(this.x1, this.y1, this.x2, this.y2); + g.setColor(this.fg); + + g.setFontAlign(0, 0).setFont(global_font, font_height); + g.drawString(this.text, this.center.x, this.center.y); + + } + +} + +class TextBox { + + constructor(x, y, text, col) { + + // x and y are the center points + this.x = x; + this.y = y; + this.text = (typeof text !== undefined) ? text : "Default"; + this.col = (typeof col !== undefined) ? col : red; + + // console.log(`Constr TextBox ${this.text} -> Center: (${this.x}, ${this.y}) | Col ${this.col}`); + } + + render() { + // console.log(`Rendering TextBox`) + + var align_center = (0, 1); + var align_right = (0, 0); + alignment = (g.stringWidth(this.text) < g.getWidth()) ? align_center : align_right; + // coords = (g.stringWidth(this.text) < g.getWidth()- 20) ? {x:this.x, y:this.y} : {x:g.getWidth()-border, y:this.y} + coords = { x: this.x, y: this.y }; + g.setColor(this.col); + g.setFontAlign(0, 0).setFont(global_font, font_height); + g.drawString(this.text, coords.x, coords.y); + + } +} + +/* Screen refresh *************************************/ + +function draw(obj) { + console.log("draw()"); + obj.render(); +} + +let tickTimer; + +function clearTickTimer() { + if (tickTimer) { + clearTimeout(tickTimer); + tickTimer = undefined; + } +} + +function queueNextTick() { + clearTickTimer(); + tickTimer = setTimeout(tick, 5000); +} + +function tick() { + console.log("tick"); + draw(window); + // queueNextTick(); +} + +/* Init **********************************************/ + +var window = new Window("abc", red); + +var l_btns = new BTN_layer("btns", "3x2"); + +var l_text = new Layer("text"); // black + +var box = new TextBox( + _screen_mid, + 12, + editable_buf, + white +); + +l_text.push(box); + +window.push(l_text); +window.push(l_btns); + +// Set up callbacks for touches + +Bangle.on('touch', function (button, xy) { + + window.top_layer().parseTaps(xy); + window.render(); + +}); + +Bangle.on('swipe', function (direction) { + + console.log(`Swipe dir ${direction}`); + + if (direction === -1) { // left + + l_text.items[0].text = l_text.items[0].text.slice(0, -1); + + } else if (direction == 1) { // right + + l_text.items[0].text += ' '; + + } + window.render(); + +}); + +// Clear the screen once, at startup +g.clear(); + +// Start ticking +tick(); \ No newline at end of file From 5674014334fb999c08a8ff313a1441a9885447fd Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 17:59:18 +0000 Subject: [PATCH 03/94] Add scribble to apps.json --- apps.json | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/apps.json b/apps.json index 13bb5892d..a0e024300 100644 --- a/apps.json +++ b/apps.json @@ -4780,5 +4780,21 @@ {"name": "flow.app.js", "url": "app.js" }, {"name": "flow.img", "url": "app-icon.js","evaluate": true } ] + }, + { "id": "scribble", + "name": "Scribble", + "shortName":"Scribble", + "version":"0.01", + "description": "A keyboard on your wrist! Swipe right for space, left for delete.", + "icon": "app.png", + "allow_emulator": true, + "tags": "tools, keyboard, text, scribble", + "supports" : ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"scribble.app.js","url":"app.js"}, + {"name":"scribble.img","url":"app-icon.js","evaluate":true} + ] } + ] From 186913c088dcf3c9ffcbc5e66a794558aa414d65 Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 18:04:11 +0000 Subject: [PATCH 04/94] Add scribble type --- apps.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps.json b/apps.json index a0e024300..b2f809904 100644 --- a/apps.json +++ b/apps.json @@ -4785,6 +4785,7 @@ "name": "Scribble", "shortName":"Scribble", "version":"0.01", + "type": "app", "description": "A keyboard on your wrist! Swipe right for space, left for delete.", "icon": "app.png", "allow_emulator": true, From f46810aa65fef333516bde2686491dd32fc799e1 Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 18:04:27 +0000 Subject: [PATCH 05/94] renamed scribble.js to app.js --- apps/scribble/{scribble.js => app.js} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename apps/scribble/{scribble.js => app.js} (100%) diff --git a/apps/scribble/scribble.js b/apps/scribble/app.js similarity index 100% rename from apps/scribble/scribble.js rename to apps/scribble/app.js From 254ba37a87673083b4ece4cc9d122d4043ca9769 Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 18:07:30 +0000 Subject: [PATCH 06/94] Fixed app icon --- apps/scribble/app-icon.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/scribble/app-icon.js b/apps/scribble/app-icon.js index b77fc9a4f..740706094 100644 --- a/apps/scribble/app-icon.js +++ b/apps/scribble/app-icon.js @@ -1 +1 @@ -var img = require("heatshrink").decompress(atob("mEwwMB/4A2/IFE+IFE+YFE84FE44FE54SEz/jAocfDAk/54EC/1/x4FC/l/z4FDCQJGD/wFD+IYBIwYSBIwf4IwhfEIwuPIwkPIwMAj//g/P/gFCkOP/AEB/8wj5+Dn0/Aoc8n/4JAU4v/8gYFBaYWAJ4MHAoPwEgMPOgUfLogJCBYQFE+AFD8BHB/EAAAV/AoYyCB4IKBc6QA==")) \ No newline at end of file +require("heatshrink").decompress(atob("mEwwMB/4A2/IFE+IFE+YFE84FE44FE54SEz/jAocfDAk/54EC/1/x4FC/l/z4FDCQJGD/wFD+IYBIwYSBIwf4IwhfEIwuPIwkPIwMAj//g/P/gFCkOP/AEB/8wj5+Dn0/Aoc8n/4JAU4v/8gYFBaYWAJ4MHAoPwEgMPOgUfLogJCBYQFE+AFD8BHB/EAAAV/AoYyCB4IKBc6QA==")) \ No newline at end of file From 5e0b4a9703c554d045d63f6bf6de13535ceebd45 Mon Sep 17 00:00:00 2001 From: qucchia Date: Tue, 7 Dec 2021 19:32:49 +0100 Subject: [PATCH 07/94] Allow Calendar app to begin on Sunday. --- apps.json | 4 +++- apps/calendar/ChangeLog | 1 + apps/calendar/README.md | 5 +++++ apps/calendar/calendar.js | 13 +++++++++++-- apps/calendar/settings.js | 24 ++++++++++++++++++++++++ 5 files changed, 44 insertions(+), 3 deletions(-) create mode 100644 apps/calendar/settings.js diff --git a/apps.json b/apps.json index 13bb5892d..745389bd7 100644 --- a/apps.json +++ b/apps.json @@ -2392,7 +2392,7 @@ { "id": "calendar", "name": "Calendar", - "version": "0.02", + "version": "0.03", "description": "Simple calendar", "icon": "calendar.png", "screenshots": [{"url":"screenshot_calendar.png"}], @@ -2402,8 +2402,10 @@ "allow_emulator": true, "storage": [ {"name":"calendar.app.js","url":"calendar.js"}, + {"name":"calendar.settings.js","url":"settings.js"}, {"name":"calendar.img","url":"calendar-icon.js","evaluate":true} ] + "data": [{"name":"messages.json"}] }, { "id": "hidjoystick", diff --git a/apps/calendar/ChangeLog b/apps/calendar/ChangeLog index 8bafff34a..de887bfa7 100644 --- a/apps/calendar/ChangeLog +++ b/apps/calendar/ChangeLog @@ -1,2 +1,3 @@ 0.01: Basic calendar 0.02: Make Bangle 2 compatible +0.03: Add setting to start week on Sunday diff --git a/apps/calendar/README.md b/apps/calendar/README.md index 19a60afc0..e22d06573 100644 --- a/apps/calendar/README.md +++ b/apps/calendar/README.md @@ -6,3 +6,8 @@ Basic calendar - Use `BTN4` (left screen tap) to go to the previous month - Use `BTN5` (right screen tap) to go to the next month + +## Settings + +- Starts on Sunday: whether the calendar should start on Sunday (default is Monday). + diff --git a/apps/calendar/calendar.js b/apps/calendar/calendar.js index 6f3c33164..5707bd97a 100644 --- a/apps/calendar/calendar.js +++ b/apps/calendar/calendar.js @@ -18,6 +18,10 @@ const gray2 = "#888888"; const gray3 = "#bbbbbb"; const red = "#d41706"; +let settings = require('Storage').readJSON("calendar.json", true) || {}; +if (settings.startOnSun === undefined) + settings.startOnSun = false; + function drawCalendar(date) { g.setBgColor(color4); g.clearRect(0, 0, maxX, maxY); @@ -61,13 +65,18 @@ function drawCalendar(date) { ); g.setFont("6x8", fontSize); - const dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]; + let dowLbls; + if (settings.startOnSun) { + dowLbls = ["Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"]; + } else { + dowLbls = ["Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"]; + } dowLbls.forEach((lbl, i) => { g.drawString(lbl, i * colW + colW / 2, headerH + rowH / 2); }); date.setDate(1); - const dow = date.getDay(); + const dow = date.getDay() + (settings.startOnSun ? 1 : 0); const dowNorm = dow === 0 ? 7 : dow; const monthMaxDayMap = { diff --git a/apps/calendar/settings.js b/apps/calendar/settings.js new file mode 100644 index 000000000..f9c7783a3 --- /dev/null +++ b/apps/calendar/settings.js @@ -0,0 +1,24 @@ +(function(back) { + var FILE = "calendar.json"; + var settings = require('Storage').readJSON(FILE, true) || {}; + if (settings.startOnSun === undefined) + settings.startOnSun = true; + + function writeSettings() { + require('Storage').writeJSON(FILE, settings); + } + + E.showMenu({ + "" : { "title" : "Calendar" }, + "< Back" : () => back(), + 'Start on Sunday': { + value: settings.startOnSun, + format: v => v?"Yes":"No", + onchange: v => { + settings.startOnSun = v; + writeSettings(); + } + }, + }); +}) + From bced3ec74970cd4eafc3a868f46d33e9e67404ae Mon Sep 17 00:00:00 2001 From: qucchia Date: Tue, 7 Dec 2021 19:39:53 +0100 Subject: [PATCH 08/94] Fix incorrect apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 745389bd7..ee8f6814f 100644 --- a/apps.json +++ b/apps.json @@ -2404,7 +2404,7 @@ {"name":"calendar.app.js","url":"calendar.js"}, {"name":"calendar.settings.js","url":"settings.js"}, {"name":"calendar.img","url":"calendar-icon.js","evaluate":true} - ] + ], "data": [{"name":"messages.json"}] }, { From 3301444939eabdc27d7a907582db92abfce6a52d Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 19:44:48 +0100 Subject: [PATCH 09/94] Update locales.js Added translations for English-Dutch --- apps/locale/locales.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index e076b70bd..419d1cefb 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -191,6 +191,23 @@ var locales = { month: "januari,februari,maart,april,mei,juni,juli,augustus,september,oktober,november,december", trans: { yes: "ja", Yes: "Ja", no: "nee", No: "Nee", ok: "ok", on: "aan", off: "uit", "< Back": "< Terug" } }, + "en_NL": { // English date units with Dutch number, currency and navigation units. + lang: "en_NL", + decimal_point: ",", + thousands_sep: ".", + currency_symbol: "€", + int_curr_symbol: "EUR", + speed: "kmh", + distance: { 0: "m", 1: "km" }, + temperature: "°C", + ampm: { 0: "am", 1: "pm" }, + timePattern: { 0: "%HH:%MM:%SS ", 1: "%HH:%MM" }, + datePattern: { 0: "%b %d %Y", 1: "%d/%m/%Y" }, // Feb 28 2020" // "01/03/2020"(short) + abmonth: "Jan,Feb,Mar,Apr,May,Jun,Jul,Aug,Sep,Oct,Nov,Dec", + month: "January,February,March,April,May,June,July,August,September,October,November,December", + abday: "Sun,Mon,Tue,Wed,Thu,Fri,Sat", + day: "Sunday,Monday,Tuesday,Wednesday,Thursday,Friday,Saturday", + }, "en_CA": { lang: "en_CA", decimal_point: ".", From afa4f1d2419ebc9caa0033a9b6ce24b51f65d791 Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 18:49:11 +0000 Subject: [PATCH 10/94] Adjusted button size --- apps/scribble/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/scribble/app.js b/apps/scribble/app.js index e8fb9e4c2..3d05f68c5 100644 --- a/apps/scribble/app.js +++ b/apps/scribble/app.js @@ -19,15 +19,15 @@ const font_height = 2; const global_font = "Dennis8"; require("FontDennis8").add(Graphics); -const editable_buf = "hello"; +const editable_buf = "Scribble"; -const left = 4; +const left = 3; const _screen_mid = g.getWidth() / 2; const right = 176 - 4; const box_size = { w: _screen_mid - 6, - h: 45, + h: 46, }; const spacing = 4; From 97338ff66414d9c7e4651334594cb94726d4b2c0 Mon Sep 17 00:00:00 2001 From: enricorov Date: Tue, 7 Dec 2021 18:49:23 +0000 Subject: [PATCH 11/94] Added screenshots --- apps.json | 3 +++ apps/scribble/screenshot.png | Bin 0 -> 2797 bytes 2 files changed, 3 insertions(+) create mode 100644 apps/scribble/screenshot.png diff --git a/apps.json b/apps.json index b2f809904..dbb2eb972 100644 --- a/apps.json +++ b/apps.json @@ -4795,6 +4795,9 @@ "storage": [ {"name":"scribble.app.js","url":"app.js"}, {"name":"scribble.img","url":"app-icon.js","evaluate":true} + ], + "screenshots":[ + { "url":"screenshot.png" } ] } diff --git a/apps/scribble/screenshot.png b/apps/scribble/screenshot.png new file mode 100644 index 0000000000000000000000000000000000000000..a3dc0cff25bd99db84b3d6dd1c764d9b8a5c7742 GIT binary patch literal 2797 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 Date: Tue, 7 Dec 2021 18:49:29 +0000 Subject: [PATCH 12/94] Added scribble readme --- apps/scribble/README.md | 24 +++++++----------------- 1 file changed, 7 insertions(+), 17 deletions(-) diff --git a/apps/scribble/README.md b/apps/scribble/README.md index dc139bc9a..651ecfbf1 100644 --- a/apps/scribble/README.md +++ b/apps/scribble/README.md @@ -1,25 +1,15 @@ -# App Name +# Scribble -Describe the app... +A tree-based keyboard, inspired by Tertiary Text on Pebble. -Add screen shots (if possible) to the app folder and link then into this file with ![](.png) +![](screenshot.png) ## Usage -Describe how to use it - -## Features - -Name the function - -## Controls - -Name the buttons and what they are used for - -## Requests - -Name who should be contacted for support/update requests +Tap a button to select text. +Swipe left to right for enter space. +Swipe right to left to delete. ## Creator -Your name +enricorov From 5d4055b3bf014ed10f8c1e11b45afc46ca68df6a Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:06:08 +0100 Subject: [PATCH 13/94] Update locales.js kmh -> km/h --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index 419d1cefb..482eb466a 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -197,7 +197,7 @@ var locales = { thousands_sep: ".", currency_symbol: "€", int_curr_symbol: "EUR", - speed: "kmh", + speed: "km/h", distance: { 0: "m", 1: "km" }, temperature: "°C", ampm: { 0: "am", 1: "pm" }, From fc5902be9bbc7dedee25a1e4b787a22e391e9ecd Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:13:46 +0100 Subject: [PATCH 14/94] Update locales.js km/h -> kmh (This did not fit in weather app) --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index 482eb466a..419d1cefb 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -197,7 +197,7 @@ var locales = { thousands_sep: ".", currency_symbol: "€", int_curr_symbol: "EUR", - speed: "km/h", + speed: "kmh", distance: { 0: "m", 1: "km" }, temperature: "°C", ampm: { 0: "am", 1: "pm" }, From 478a6a6eda03b3fe14fdf2e9eaf1a4e83abecbee Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Tue, 7 Dec 2021 20:23:15 +0100 Subject: [PATCH 15/94] ios 0.05: Added more bundleId's --- apps/ios/boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 33eb8261c..6e8c864a8 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -86,7 +86,7 @@ E.on('notify',msg=>{ "com.zhiliaoapp.musically": "TikTok", "net.whatsapp.WhatsApp": "WhatsApp", "nl.ah.Appie": "Albert Heijn", - "nl.postnl.postnl": "PostNL", + "nl.postnl.TrackNTrace": "PostNL", "ph.telegra.Telegraph": "Telegram", // could also use NRF.ancsGetAppInfo(msg.appId) here From e0136ca4b73cf3089ab1559b39c4f2aebee38d64 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:25:15 +0100 Subject: [PATCH 16/94] Update app.js --- apps/weatherClock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weatherClock/app.js b/apps/weatherClock/app.js index 46cc38312..691bdc31d 100644 --- a/apps/weatherClock/app.js +++ b/apps/weatherClock/app.js @@ -110,7 +110,7 @@ function draw() { clockLayout.tempUnit.label = temp[2]; clockLayout.weatherIcon.src = chooseIcon(currentWeather.txt); const wind = locale.speed(currentWeather.wind).match(/^(\D*\d*)(.*)$/); - clockLayout.wind.label = wind[1] + " "; + clockLayout.wind.label = wind[1] + " "; clockLayout.windUnit.label = wind[2] + " " + (currentWeather.wrose||'').toUpperCase(); } else{ From 2cb77e8f890064110ce67ab64c40d99552580286 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:37:50 +0100 Subject: [PATCH 17/94] Update app.js Extra space to fix wind speed layout --- apps/weatherClock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weatherClock/app.js b/apps/weatherClock/app.js index 691bdc31d..2d6fb9375 100644 --- a/apps/weatherClock/app.js +++ b/apps/weatherClock/app.js @@ -110,7 +110,7 @@ function draw() { clockLayout.tempUnit.label = temp[2]; clockLayout.weatherIcon.src = chooseIcon(currentWeather.txt); const wind = locale.speed(currentWeather.wind).match(/^(\D*\d*)(.*)$/); - clockLayout.wind.label = wind[1] + " "; + clockLayout.wind.label = wind[1] + " "; clockLayout.windUnit.label = wind[2] + " " + (currentWeather.wrose||'').toUpperCase(); } else{ From c94c5860acfaa222df12814dfdeddae25466bb1e Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 20:40:28 +0100 Subject: [PATCH 18/94] Update locales.js Test --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index 419d1cefb..b973150a1 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -8,7 +8,7 @@ const distanceUnits = { // how many meters per X? "nm": 1852 }; const speedUnits = { // how many kph per X? - "kmh": 1, + "kmh": 1.00, "kph": 1, "km/h": 1, "mph": 1.60934, From 63dee9203abfadfdf0a1d17f5c5671eae2abb716 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 21:00:18 +0100 Subject: [PATCH 19/94] Update apps.json Extra space for layout fix --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 13bb5892d..cebdda26a 100644 --- a/apps.json +++ b/apps.json @@ -4721,7 +4721,7 @@ { "id": "weatherClock", "name": "Weather Clock", - "version": "0.02", + "version": "0.021", "description": "A clock which displays current weather conditions (requires Gadgetbridge and Weather apps).", "icon": "app.png", "screenshots": [{"url":"screens/screen1.png"}], From 0a89c1f878fd32ae40f0de896eba70c733c6d8da Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 21:00:59 +0100 Subject: [PATCH 20/94] Update ChangeLog --- apps/weatherClock/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/weatherClock/ChangeLog b/apps/weatherClock/ChangeLog index f4a63e976..7f1150ee4 100644 --- a/apps/weatherClock/ChangeLog +++ b/apps/weatherClock/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Minor layout format tweak so it uses less memory and draws ok on Bangle.js 1 (#1012) +0.021: Minor layout extra space. From 4f53c59e0d3bf30cb7295c329bb4d593742c4fa0 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 21:06:41 +0100 Subject: [PATCH 21/94] Update locales.js --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index b973150a1..419d1cefb 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -8,7 +8,7 @@ const distanceUnits = { // how many meters per X? "nm": 1852 }; const speedUnits = { // how many kph per X? - "kmh": 1.00, + "kmh": 1, "kph": 1, "km/h": 1, "mph": 1.60934, From b96ec91453ec24348f942d240111b4afc8701b0d Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Tue, 7 Dec 2021 21:24:25 +0100 Subject: [PATCH 22/94] Update app.js Add extra space to day of week --- apps/weatherClock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weatherClock/app.js b/apps/weatherClock/app.js index 2d6fb9375..455eaf029 100644 --- a/apps/weatherClock/app.js +++ b/apps/weatherClock/app.js @@ -101,7 +101,7 @@ function draw() { var date = new Date(); clockLayout.time.label = locale.time(date, 1); clockLayout.date.label = locale.date(date, 1).toUpperCase(); - clockLayout.dow.label = locale.dow(date, 1).toUpperCase(); + clockLayout.dow.label = locale.dow(date, 1).toUpperCase() + " "; var weatherJson = getWeather(); if(weatherJson && weatherJson.weather){ var currentWeather = weatherJson.weather; From 57e25085dc02734e88da33ac615ebf966202afd3 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 21:20:33 +0100 Subject: [PATCH 23/94] Fix redundant parenthesis --- apps/qrcode/custom.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html index 618840da9..039b47c23 100644 --- a/apps/qrcode/custom.html +++ b/apps/qrcode/custom.html @@ -108,7 +108,7 @@ g.clear(1).setColor(1,1,1).setBgColor(0,0,0); g.fillRect(0,0,g.getWidth()-1,g.getHeight()-1); g.drawImage(img,(g.getWidth()-img[0])/2,(g.getHeight()-img[1])/2); g.setFontAlign(0,0).setFont("6x8").setColor(0,0,0); -g.drawString(content,g.getWidth()/2,g.getHeight()-(g.getHeight()-img[1])/4)); +g.drawString(content,g.getWidth()/2,g.getHeight()-(g.getHeight()-img[1])/4); g.setColor(1,1,1); `; sendCustomizedApp({ From fd8c1c237f2821ad08e8d53d706b0985f20b7098 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 19:16:41 +0100 Subject: [PATCH 24/94] Allow hiding the description --- apps/qrcode/custom.html | 22 +++++++++++++++++----- 1 file changed, 17 insertions(+), 5 deletions(-) diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html index 039b47c23..5e29d7467 100644 --- a/apps/qrcode/custom.html +++ b/apps/qrcode/custom.html @@ -3,8 +3,8 @@ - - + +
@@ -25,6 +25,14 @@ +
+

Additional options:

+ +
+ + + +

Try your QR Code:

Click

@@ -101,14 +109,18 @@ if(document.getElementById("useWIFI").checked){ content = document.getElementById("ssid").value } + if(!(document.getElementById("description").value === "")){ + content = document.getElementById("description").value; + } var img = imageconverter.canvastoString(document.getElementsByTagName("canvas")[0],{mode:"1bit",output:"string",compression:true}); var app = `var img = ${img}; -var content = ${JSON.stringify(content)}; +${ document.getElementById("hideDescription").checked ? '' : `var content = ${JSON.stringify(content)};`} g.clear(1).setColor(1,1,1).setBgColor(0,0,0); g.fillRect(0,0,g.getWidth()-1,g.getHeight()-1); g.drawImage(img,(g.getWidth()-img[0])/2,(g.getHeight()-img[1])/2); -g.setFontAlign(0,0).setFont("6x8").setColor(0,0,0); -g.drawString(content,g.getWidth()/2,g.getHeight()-(g.getHeight()-img[1])/4); +${ document.getElementById("hideDescription").checked ? '' : `g.setFontAlign(0,0).setFont("6x8").setColor(0,0,0); +g.drawString(content,g.getWidth()/2,g.getHeight()-(g.getHeight()-img[1])/4)); +`} g.setColor(1,1,1); `; sendCustomizedApp({ From 8cc770a69e3a54a2e01dd04e67b9e10ce9c0e809 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 19:45:12 +0100 Subject: [PATCH 25/94] Only use integer scaling for clearer QR codes --- apps/qrcode/custom.html | 30 ++++++++++++++++++++++-------- 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html index 5e29d7467..75b9823c5 100644 --- a/apps/qrcode/custom.html +++ b/apps/qrcode/custom.html @@ -42,21 +42,19 @@ @@ -95,6 +97,7 @@ return qrstring; } function refreshQRCode(){ + document.getElementById("errors").innerText=""; qrcode.clear(); // clear the code. var qrText = ""; if(document.getElementById("useWIFI").checked){ @@ -109,10 +112,17 @@ } qrcode._htOption.text = qrText; qrcode._htOption.correctLevel = parseInt(document.getElementById("correction").value); - qrcode.makeCode(qrText); + try { + qrcode.makeCode(qrText); + } catch (error) { + document.getElementById("errors").innerText="Error: QR could not be created."; + console.error(error); + } var integerScale = Math.max(Math.floor(targetSize / (qrcode._oQRCode.moduleCount + 1)),1); + if (integerScale == 1) document.getElementById("errors").innerText = "Warning, QR will probably be too small to properly scan. Try less data or less error correction."; + finalSizeQr = integerScale * (qrcode._oQRCode.moduleCount + 1); finalSizeCanvas = finalSizeQr - 1; @@ -121,8 +131,12 @@ document.getElementsByTagName("canvas")[0].width = finalSizeCanvas; document.getElementsByTagName("canvas")[0].height = finalSizeCanvas; - - qrcode.makeCode(qrText); + try { + qrcode.makeCode(qrText); + } catch (error) { + document.getElementById("errors").innerText="Error: QR could not be created."; + console.error(error); + } } var qrcode; From 8c313c446e005d011e2b36d839caa486b5ed35a4 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 22:57:35 +0100 Subject: [PATCH 30/94] Update changelog --- apps/qrcode/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/qrcode/ChangeLog b/apps/qrcode/ChangeLog index e2ae6b02a..91121ac6e 100644 --- a/apps/qrcode/ChangeLog +++ b/apps/qrcode/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Add posibillity to generate Wifi code. +0.03: Forces integer scaling and adds more configuration (error correction, description, display) From e97c3041d8a16843a38e56d8525fd45c300cb249 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 23:08:20 +0100 Subject: [PATCH 31/94] Adds option to prevent integer scaling --- apps/qrcode/custom.html | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html index a92b46338..22aea3422 100644 --- a/apps/qrcode/custom.html +++ b/apps/qrcode/custom.html @@ -28,6 +28,8 @@

Additional options:

+ +

@@ -119,13 +121,18 @@ console.error(error); } + var finalSizeQr=targetSize; + var finalSizeCanvas=targetSize; + var integerScale = Math.max(Math.floor(targetSize / (qrcode._oQRCode.moduleCount + 1)),1); - if (integerScale == 1) document.getElementById("errors").innerText = "Warning, QR will probably be too small to properly scan. Try less data or less error correction."; - - finalSizeQr = integerScale * (qrcode._oQRCode.moduleCount + 1); - finalSizeCanvas = finalSizeQr - 1; - + + if (!document.getElementById("preventIntegerScaling").checked){ + + finalSizeQr = integerScale * (qrcode._oQRCode.moduleCount + 1); + finalSizeCanvas = finalSizeQr - 1; + } + qrcode._htOption.width = finalSizeQr; qrcode._htOption.height = finalSizeQr; @@ -147,6 +154,7 @@ document.getElementById("hidden").addEventListener("change",refreshQRCode); document.getElementById("useTEXT").addEventListener("change",refreshQRCode); document.getElementById("useWIFI").addEventListener("change",refreshQRCode); + document.getElementById("preventIntegerScaling").addEventListener("change",refreshQRCode); document.getElementById("correction").addEventListener("change",refreshQRCode); document.getElementById("upload").addEventListener("click", function() { var content = document.getElementById("text").value; From d28bbdd286c4a0edd1eea41f6881209454a8fdb2 Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Tue, 7 Dec 2021 23:13:09 +0100 Subject: [PATCH 32/94] Move the additional options group down to make the qr visible --- apps/qrcode/custom.html | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/apps/qrcode/custom.html b/apps/qrcode/custom.html index 22aea3422..eb9906f57 100644 --- a/apps/qrcode/custom.html +++ b/apps/qrcode/custom.html @@ -26,6 +26,11 @@ + +
+

+

Try your QR Code:

+

Additional options:

@@ -46,14 +51,10 @@ - - -
-

-

Try your QR Code:

- +

Click

+ From e93615e3d3e12ed16e4b0d98dde981e2ea011ea8 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Tue, 7 Dec 2021 23:19:12 +0100 Subject: [PATCH 33/94] We check lowercase strings, so also lowercase checks :-) --- apps/messages/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/messages/app.js b/apps/messages/app.js index 6c9972fd8..38968ced5 100644 --- a/apps/messages/app.js +++ b/apps/messages/app.js @@ -69,7 +69,7 @@ function getNegImage() { function getMessageImage(msg) { if (msg.img) return atob(msg.img); var s = (msg.src||"").toLowerCase(); - if (s=="Phone") return atob("FxeBABgAAPgAAfAAB/AAD+AAH+AAP8AAP4AAfgAA/AAA+AAA+AAA+AAB+AAB+AAB+OAB//AB//gB//gA//AA/8AAf4AAPAA="); + if (s=="phone") return atob("FxeBABgAAPgAAfAAB/AAD+AAH+AAP8AAP4AAfgAA/AAA+AAA+AAA+AAB+AAB+AAB+OAB//AB//gB//gA//AA/8AAf4AAPAA="); if (s=="skype") return atob("GhoBB8AAB//AA//+Af//wH//+D///w/8D+P8Afz/DD8/j4/H4fP5/A/+f4B/n/gP5//B+fj8fj4/H8+DB/PwA/x/A/8P///B///gP//4B//8AD/+AAA+AA=="); if (s=="hangouts") return atob("FBaBAAH4AH/gD/8B//g//8P//H5n58Y+fGPnxj5+d+fmfj//4//8H//B//gH/4A/8AA+AAHAABgAAAA="); if (s=="whatsapp") return atob("GBiBAAB+AAP/wAf/4A//8B//+D///H9//n5//nw//vw///x///5///4///8e//+EP3/APn/wPn/+/j///H//+H//8H//4H//wMB+AA=="); From 261a680e6c1c4e1fb44d5ac10e37102630c6cb9d Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Wed, 8 Dec 2021 01:40:39 +0100 Subject: [PATCH 34/94] try to use ancsGetAppInfo --- apps/ios/boot.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 6e8c864a8..6821b9549 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -91,6 +91,14 @@ E.on('notify',msg=>{ // could also use NRF.ancsGetAppInfo(msg.appId) here }; + + var aName = ''; + NRF.ancsGetAppInfo( msg.appId ).then( ai => { + aName = ai.title; + }).catch(error => { + aName = appNames[msg.appId] || msg.appId; + }); + var unicodeRemap = { '2019':"'" }; @@ -99,7 +107,7 @@ E.on('notify',msg=>{ require("messages").pushMessage({ t : msg.event, id : msg.uid, - src : appNames[msg.appId] || msg.appId, + src : aName, title : msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer), subject : msg.subtitle&&E.decodeUTF8(msg.subtitle, unicodeRemap, replacer), body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer) From f1cb286daf9caa2a5ff84d49795b63fc954be792 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Wed, 8 Dec 2021 01:45:29 +0100 Subject: [PATCH 35/94] revert --- apps/ios/boot.js | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 6821b9549..6e8c864a8 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -91,14 +91,6 @@ E.on('notify',msg=>{ // could also use NRF.ancsGetAppInfo(msg.appId) here }; - - var aName = ''; - NRF.ancsGetAppInfo( msg.appId ).then( ai => { - aName = ai.title; - }).catch(error => { - aName = appNames[msg.appId] || msg.appId; - }); - var unicodeRemap = { '2019':"'" }; @@ -107,7 +99,7 @@ E.on('notify',msg=>{ require("messages").pushMessage({ t : msg.event, id : msg.uid, - src : aName, + src : appNames[msg.appId] || msg.appId, title : msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer), subject : msg.subtitle&&E.decodeUTF8(msg.subtitle, unicodeRemap, replacer), body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer) From 456c4f40192cdf88b5c4c09d4a4584d13f486bcf Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Wed, 8 Dec 2021 02:05:35 +0100 Subject: [PATCH 36/94] Fix #968: messages app should not pop up with old messages --- apps.json | 4 ++-- apps/ios/ChangeLog | 1 + apps/ios/boot.js | 8 ++++++++ apps/messages/ChangeLog | 1 + apps/messages/lib.js | 6 +++++- 5 files changed, 17 insertions(+), 3 deletions(-) diff --git a/apps.json b/apps.json index 9905a0cdc..fad1e9c6e 100644 --- a/apps.json +++ b/apps.json @@ -57,7 +57,7 @@ { "id": "messages", "name": "Messages", - "version": "0.08", + "version": "0.09", "description": "App to display notifications from iOS and Gadgetbridge", "icon": "app.png", "type": "app", @@ -95,7 +95,7 @@ { "id": "ios", "name": "iOS Integration", - "version": "0.05", + "version": "0.06", "description": "(BETA) App to display notifications from iOS devices", "icon": "app.png", "tags": "tool,system,ios,apple,messages,notifications", diff --git a/apps/ios/ChangeLog b/apps/ios/ChangeLog index 5bafc4d98..28ad78dec 100644 --- a/apps/ios/ChangeLog +++ b/apps/ios/ChangeLog @@ -4,3 +4,4 @@ 0.04: Added common bundleId's 0.05: Added more bundleId's (app-id's which can be used to determine a friendly app name in the notifications) +0.06: Fix (not) popupping up old messages \ No newline at end of file diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 6e8c864a8..846ce93d3 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -26,6 +26,13 @@ E.on('ANCS',msg=>{ function ancsHandler() { var msg = Bangle.ancsMessageQueue[0]; NRF.ancsGetNotificationInfo( msg.uid ).then( info => { + + if(msg.preExisting){ + info.new = false; + } else { + info.new = true; + } + E.emit("notify", Object.assign(msg, info)); Bangle.ancsMessageQueue.shift(); if (Bangle.ancsMessageQueue.length) @@ -100,6 +107,7 @@ E.on('notify',msg=>{ t : msg.event, id : msg.uid, src : appNames[msg.appId] || msg.appId, + new : msg.new, title : msg.title&&E.decodeUTF8(msg.title, unicodeRemap, replacer), subject : msg.subtitle&&E.decodeUTF8(msg.subtitle, unicodeRemap, replacer), body : msg.message&&E.decodeUTF8(msg.message, unicodeRemap, replacer) diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog index 5c65b150d..84c5b7551 100644 --- a/apps/messages/ChangeLog +++ b/apps/messages/ChangeLog @@ -10,3 +10,4 @@ 0.07: Added settings menu with option to choose vibrate pattern and frequency (fix #909) 0.08: Fix rendering of long messages (fix #969) buzz on new message (fix #999) +0.09: Respect the 'new' attribute if it was set from iOS integrations \ No newline at end of file diff --git a/apps/messages/lib.js b/apps/messages/lib.js index 4593c8605..acfef536f 100644 --- a/apps/messages/lib.js +++ b/apps/messages/lib.js @@ -16,7 +16,11 @@ exports.pushMessage = function(event) { if (mIdx>=0) messages.splice(mIdx, 1); // remove item mIdx=-1; } else { // add/modify - if (event.t=="add") event.new=true; // new message + if (event.t=="add"){ + if(event.new === undefined ) { // If 'new' has not been set yet, set it + event.new=true; // Assume it should be new + } + } if (mIdx<0) { mIdx=0; messages.unshift(event); // add new messages to the beginning From cf604588bfde5bf292fa10f44f7e6f70a4e364bf Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Wed, 8 Dec 2021 02:06:15 +0100 Subject: [PATCH 37/94] Fix #968: messages app should not pop up with old messages --- apps/ios/boot.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index 846ce93d3..bf14aeb07 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -27,7 +27,7 @@ E.on('ANCS',msg=>{ var msg = Bangle.ancsMessageQueue[0]; NRF.ancsGetNotificationInfo( msg.uid ).then( info => { - if(msg.preExisting){ + if(msg.preExisting === true){ info.new = false; } else { info.new = true; From f61d5c8d573eedc6545cd97124e23ab8c8178973 Mon Sep 17 00:00:00 2001 From: Jeroen Peters Date: Wed, 8 Dec 2021 02:22:06 +0100 Subject: [PATCH 38/94] Fix #968: messages app should not pop up with old messages --- apps/ios/boot.js | 2 ++ apps/messages/lib.js | 8 ++++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/apps/ios/boot.js b/apps/ios/boot.js index bf14aeb07..d402facbb 100644 --- a/apps/ios/boot.js +++ b/apps/ios/boot.js @@ -56,6 +56,7 @@ E.on('notify',msg=>{ "message" : string, "messageSize" : string, "date" : string, + "new" : boolean, "posAction" : string, "negAction" : string, "name" : string, @@ -64,6 +65,7 @@ E.on('notify',msg=>{ "com.apple.facetime": "FaceTime", "com.apple.mobilecal": "Calendar", "com.apple.mobilemail": "Mail", + "com.apple.MobileSMS": "SMS Message", "com.apple.Passbook": "iOS Wallet", "com.apple.reminders": "Reminders", "com.apple.shortcuts": "Shortcuts", diff --git a/apps/messages/lib.js b/apps/messages/lib.js index acfef536f..586a82b67 100644 --- a/apps/messages/lib.js +++ b/apps/messages/lib.js @@ -1,6 +1,6 @@ exports.pushMessage = function(event) { /* event is: - {t:"add",id:int, src,title,subject,body,sender,tel, important:bool} // add new + {t:"add",id:int, src,title,subject,body,sender,tel, important:bool, new:bool} // add new {t:"add",id:int, id:"music", state, artist, track, etc} // add new {t:"remove-",id:int} // remove {t:"modify",id:int, title:string} // modified @@ -31,7 +31,11 @@ exports.pushMessage = function(event) { // if in app, process immediately if (inApp) return onMessagesModified(mIdx<0 ? {id:event.id} : messages[mIdx]); // ok, saved now - we only care if it's new - if (event.t!="add") return; + if (event.t!="add") { + return; + } else if(event.new == false) { + return; + } // otherwise load messages/show widget var loadMessages = Bangle.CLOCK || event.important; // first, buzz From 1d2f3c049dcb1df25e204db3dbb435cce82436bd Mon Sep 17 00:00:00 2001 From: Martin Boonk Date: Wed, 8 Dec 2021 08:30:06 +0100 Subject: [PATCH 39/94] Bump version --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 13bb5892d..23bc9ebf3 100644 --- a/apps.json +++ b/apps.json @@ -1126,7 +1126,7 @@ { "id": "qrcode", "name": "Custom QR Code", - "version": "0.02", + "version": "0.03", "description": "Use this to upload a customised QR code to Bangle.js", "icon": "app.png", "tags": "qrcode", From ccd1cd1f3cc80d9005e15b6d711d39e7e4d802c5 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 10:19:58 +0100 Subject: [PATCH 40/94] Update settings.js New setting: Hide Widget --- apps/weather/settings.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/apps/weather/settings.js b/apps/weather/settings.js index 1cc097e3a..7e2c043b9 100644 --- a/apps/weather/settings.js +++ b/apps/weather/settings.js @@ -19,6 +19,14 @@ }, onchange: x => save('expiry', x), }, + 'Hide Widget': { + value: "hide" in settings ? settings.hide : false, + format: () => (settings.hide ? 'Yes' : 'No'), + onchange: () => { + settings.hide = !settings.hide + save('hide', settings.hide); + }, + }, '< Back': back, }); }) From 92d3164029b30a1a4e557572fae53bb5430dcf4e Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 10:23:48 +0100 Subject: [PATCH 41/94] Update widget.js Load settings from file and obey 'hide' setting --- apps/weather/widget.js | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/apps/weather/widget.js b/apps/weather/widget.js index 4871ceda4..0e264209f 100644 --- a/apps/weather/widget.js +++ b/apps/weather/widget.js @@ -26,10 +26,26 @@ dirty = false; } }); + + let settings; + + function loadSettings() { + const d = require('Storage').readJSON('weather.json', 1) || {}; + settings = d.settings || {}; + } + + function setting(key) { + if (!settings) { loadSettings(); } + const DEFAULTS = { + 'expiry': 2*3600000, + 'hide': false + }; + return (key in settings) ? settings[key] : DEFAULTS[key]; + } WIDGETS["weather"] = { area: "tl", - width: weather.get() ? 20 : 0, + width: weather.get() && !setting('hide') ? 20 : 0, draw: function() { const w = weather.get(); if (!w) return; From 8bcedfa552171d4b1b3df1fb764da42515a148bd Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 10:27:14 +0100 Subject: [PATCH 42/94] Update readme.md Add settings to README --- apps/weather/readme.md | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/apps/weather/readme.md b/apps/weather/readme.md index e2fb886b7..6d0ea04a5 100644 --- a/apps/weather/readme.md +++ b/apps/weather/readme.md @@ -11,6 +11,12 @@ You can view the full report through the app: 1. Install [Gadgetbridge for Android](https://f-droid.org/packages/nodomain.freeyourgadget.gadgetbridge/) on your phone. 2. Set up [Gadgetbridge weather reporting](https://codeberg.org/Freeyourgadget/Gadgetbridge/wiki/Weather). +## Settings + +* Expiration timespan can be set after which the local weather data is considered as invalid +* Widget can be hidden + ## Controls -BTN2: opens the launcher +BTN2: opens the launcher (Bangle.js 1) +BTN: opens the launcher (Bangle.js 2) From b6b7aa8a465f233d76739f373cd6669a070fb091 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 10:37:02 +0100 Subject: [PATCH 43/94] Update widget.js * Load settings on reload of widget * Do not draw widget when `hide` is set --- apps/weather/widget.js | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/apps/weather/widget.js b/apps/weather/widget.js index 0e264209f..cf3b15645 100644 --- a/apps/weather/widget.js +++ b/apps/weather/widget.js @@ -1,9 +1,26 @@ (() => { const weather = require('weather'); - + var dirty = false; + + let settings; + + function loadSettings() { + const d = require('Storage').readJSON('weather.json', 1) || {}; + settings = d.settings || {}; + } + + function setting(key) { + if (!settings) { loadSettings(); } + const DEFAULTS = { + 'expiry': 2*3600000, + 'hide': false + }; + return (key in settings) ? settings[key] : DEFAULTS[key]; + } weather.on("update", w => { + if (setting('hide')) return; if (w) { if (!WIDGETS["weather"].width) { WIDGETS["weather"].width = 20; @@ -21,27 +38,11 @@ }); Bangle.on('lcdPower', on => { - if (on && dirty) { + if (on && dirty && !setting('hide')) { WIDGETS["weather"].draw(); dirty = false; } }); - - let settings; - - function loadSettings() { - const d = require('Storage').readJSON('weather.json', 1) || {}; - settings = d.settings || {}; - } - - function setting(key) { - if (!settings) { loadSettings(); } - const DEFAULTS = { - 'expiry': 2*3600000, - 'hide': false - }; - return (key in settings) ? settings[key] : DEFAULTS[key]; - } WIDGETS["weather"] = { area: "tl", @@ -63,5 +64,9 @@ g.drawString(t, this.x+10, this.y+24); } }, + reload:function() { + loadSettings(); + WIDGETS["weather"].redraw(); + }, }; })(); From aa94abe3befe36085d4e8ab69713c312ba076cef Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 8 Dec 2021 10:13:42 +0000 Subject: [PATCH 44/94] tweaks to allow lint to pass after #1019 --- apps/scribble/app.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/apps/scribble/app.js b/apps/scribble/app.js index 3d05f68c5..99ee3f717 100644 --- a/apps/scribble/app.js +++ b/apps/scribble/app.js @@ -12,7 +12,7 @@ const transp = -1; const abc = "abcdefghijklmnopqrstuvwxyz1234567890"; // const abc_up = "ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890"; const uppercase = 1; -const last_layer = false; // set to true at the last layer of the tree +var last_layer = false; // set to true at the last layer of the tree let chunk_size = 6; const font_height = 2; @@ -156,7 +156,7 @@ class Layer { class BTN_layer extends Layer { constructor(label, layout) { - + super(); Layer.call(this, label) this.alphabet = (uppercase) ? abc.toUpperCase() : abc; @@ -466,4 +466,4 @@ Bangle.on('swipe', function (direction) { g.clear(); // Start ticking -tick(); \ No newline at end of file +tick(); From b017a3e91b5ea61ce9ea7b91035edee9d28ecfb7 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 11:30:21 +0100 Subject: [PATCH 45/94] Update widget.js * Fix loading of settings * Do not draw widget if `hide` is true --- apps/weather/widget.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps/weather/widget.js b/apps/weather/widget.js index cf3b15645..f2ddf0b5b 100644 --- a/apps/weather/widget.js +++ b/apps/weather/widget.js @@ -6,8 +6,7 @@ let settings; function loadSettings() { - const d = require('Storage').readJSON('weather.json', 1) || {}; - settings = d.settings || {}; + settings = require('Storage').readJSON('weather.json', 1) || {}; } function setting(key) { @@ -48,6 +47,7 @@ area: "tl", width: weather.get() && !setting('hide') ? 20 : 0, draw: function() { + if (setting('hide')) return; const w = weather.get(); if (!w) return; g.reset(); From 0ef58851bc67ea7e80f28bc622c62131bd4c5bf5 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 11:33:17 +0100 Subject: [PATCH 46/94] Update ChangeLog Update changelog --- apps/weather/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/weather/ChangeLog b/apps/weather/ChangeLog index c1a0504a4..95f943e6d 100644 --- a/apps/weather/ChangeLog +++ b/apps/weather/ChangeLog @@ -8,3 +8,4 @@ 0.09: Fix crash when weather.json is absent. 0.10: Use new Layout library 0.11: Bangle.js 2 support +0.12: Allow hiding the widget From ef51f755ef7aaf2c78369ef2c64632ab8a49fe18 Mon Sep 17 00:00:00 2001 From: Marco H Date: Wed, 8 Dec 2021 11:34:00 +0100 Subject: [PATCH 47/94] Update apps.json Update weather version in apps.json --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 13bb5892d..2c9b9148e 100644 --- a/apps.json +++ b/apps.json @@ -823,7 +823,7 @@ { "id": "weather", "name": "Weather", - "version": "0.11", + "version": "0.12", "description": "Show Gadgetbridge weather report", "icon": "icon.png", "screenshots": [{"url":"screenshot.png"}], From ed36d800b15f19f6a47f72cb4c3bce27c1688788 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:36:28 +0100 Subject: [PATCH 48/94] Update locales.js kmh -> km/h for en_NL. km/h works fine with new WeatherClock v0.03 --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index 419d1cefb..482eb466a 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -197,7 +197,7 @@ var locales = { thousands_sep: ".", currency_symbol: "€", int_curr_symbol: "EUR", - speed: "kmh", + speed: "km/h", distance: { 0: "m", 1: "km" }, temperature: "°C", ampm: { 0: "am", 1: "pm" }, From c45393cce1c50c622f457e5c4afc784b192b5782 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:37:34 +0100 Subject: [PATCH 49/94] Update apps.json Weather Clock v0.02 -> v0.03 --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index cebdda26a..7dbc58e3a 100644 --- a/apps.json +++ b/apps.json @@ -13,7 +13,7 @@ "storage": [], "sortorder": -20 }, - { + {a "id": "boot", "name": "Bootloader", "version": "0.37", @@ -4721,7 +4721,7 @@ { "id": "weatherClock", "name": "Weather Clock", - "version": "0.021", + "version": "0.03", "description": "A clock which displays current weather conditions (requires Gadgetbridge and Weather apps).", "icon": "app.png", "screenshots": [{"url":"screens/screen1.png"}], From bfec01ca2b46232cd2f9ca6f8b91b5749134e4fd Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:40:29 +0100 Subject: [PATCH 50/94] Update ChangeLog Add extra spaces for better layout, especially when locale for speedUnits is 'km/h' there was a text overlap. --- apps/weatherClock/ChangeLog | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weatherClock/ChangeLog b/apps/weatherClock/ChangeLog index 7f1150ee4..600f93be2 100644 --- a/apps/weatherClock/ChangeLog +++ b/apps/weatherClock/ChangeLog @@ -1,3 +1,3 @@ 0.01: New App! 0.02: Minor layout format tweak so it uses less memory and draws ok on Bangle.js 1 (#1012) -0.021: Minor layout extra space. +0.03: Minor layout extra spaces. From f1bacffca66932eacc2c4f57b74bb8f68ab93dfd Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Wed, 8 Dec 2021 11:42:58 +0100 Subject: [PATCH 51/94] Update apps.json Typo fix --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 7dbc58e3a..54b1b8f7e 100644 --- a/apps.json +++ b/apps.json @@ -13,7 +13,7 @@ "storage": [], "sortorder": -20 }, - {a + { "id": "boot", "name": "Bootloader", "version": "0.37", From 1e733d4378f4fe5ca50ffc7a4063cc11c7f920e3 Mon Sep 17 00:00:00 2001 From: lunctis-viribus <31998224+lunctis-viribus@users.noreply.github.com> Date: Wed, 8 Dec 2021 12:08:41 +0100 Subject: [PATCH 52/94] Update app.js Layout tweak. Make number of spaces dependent on length of locale speedUnits variable. --- apps/weatherClock/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/weatherClock/app.js b/apps/weatherClock/app.js index 455eaf029..9dd49427f 100644 --- a/apps/weatherClock/app.js +++ b/apps/weatherClock/app.js @@ -110,7 +110,7 @@ function draw() { clockLayout.tempUnit.label = temp[2]; clockLayout.weatherIcon.src = chooseIcon(currentWeather.txt); const wind = locale.speed(currentWeather.wind).match(/^(\D*\d*)(.*)$/); - clockLayout.wind.label = wind[1] + " "; + clockLayout.wind.label = wind[1] + " ".repeat(wind[2].length-1); clockLayout.windUnit.label = wind[2] + " " + (currentWeather.wrose||'').toUpperCase(); } else{ From e908a542ea2279d5791a7f6eb0596d85845dec66 Mon Sep 17 00:00:00 2001 From: Johannes Schneider Date: Wed, 8 Dec 2021 13:07:50 +0100 Subject: [PATCH 53/94] shortened German date string (fixing issue #1028) --- apps/locale/locales.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/locale/locales.js b/apps/locale/locales.js index 034e7205e..f4ee1fb43 100644 --- a/apps/locale/locales.js +++ b/apps/locale/locales.js @@ -130,7 +130,7 @@ var locales = { temperature: "°C", ampm: { 0: "", 1: "" }, timePattern: { 0: "%HH:%MM:%SS", 1: "%HH:%MM" }, - datePattern: { 0: "%A, %d. %B %Y", "1": "%d.%m.%Y" }, // Sonntag, 1. März 2020 // 01.01.20 + datePattern: { 0: "%d. %b %Y", "1": "%d.%m.%Y" }, // 1. Mär 2020 // 01.03.20 abmonth: "Jan,Feb,Mär,Apr,Mai,Jun,Jul,Aug,Sep,Okt,Nov,Dez", month: "Januar,Februar,März,April,Mai,Juni,Juli,August,September,Oktober,November,Dezember", abday: "So,Mo,Di,Mi,Do,Fr,Sa", From f4f0541c4bca191bafaff812f207a6b37b604a1e Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Wed, 8 Dec 2021 15:02:48 +0000 Subject: [PATCH 54/94] 0.13: Now use shorter de_DE date format to more closely match other languages for size --- apps.json | 2 +- apps/locale/ChangeLog | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index e594071db..e5d6dad8a 100644 --- a/apps.json +++ b/apps.json @@ -197,7 +197,7 @@ { "id": "locale", "name": "Languages", - "version": "0.12", + "version": "0.13", "description": "Translations for different countries", "icon": "locale.png", "type": "locale", diff --git a/apps/locale/ChangeLog b/apps/locale/ChangeLog index ac4352f33..509d67077 100644 --- a/apps/locale/ChangeLog +++ b/apps/locale/ChangeLog @@ -12,3 +12,4 @@ 0.10: Apply 12hour setting to time 0.11: Added translations for nl_NL and changes one formatting 0.12: Fixed nl_NL formatting, because the full months won't fit on the Bangle.js2's screen +0.13: Now use shorter de_DE date format to more closely match other languages for size From 53cc58845abd00347f6c0ea25ebc5855be0b97ba Mon Sep 17 00:00:00 2001 From: jeffyactive Date: Wed, 8 Dec 2021 11:12:03 -0500 Subject: [PATCH 55/94] Advertise app name as Espruino manufacturer data when idle --- apps.json | 2 +- apps/emojuino/ChangeLog | 1 + apps/emojuino/emojuino.js | 20 +++++++++++++++++--- 3 files changed, 19 insertions(+), 4 deletions(-) diff --git a/apps.json b/apps.json index e5d6dad8a..87f4e5dd2 100644 --- a/apps.json +++ b/apps.json @@ -4387,7 +4387,7 @@ "id": "emojuino", "name": "Emojuino", "shortName": "Emojuino", - "version": "0.02", + "version": "0.03", "description": "Emojis & Espruino: broadcast Unicode emojis via Bluetooth Low Energy.", "icon": "emojuino.png", "screenshots": [ diff --git a/apps/emojuino/ChangeLog b/apps/emojuino/ChangeLog index 1c99f1970..04367183f 100644 --- a/apps/emojuino/ChangeLog +++ b/apps/emojuino/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Upgraded text to images, added welcome screen and subtitles. +0.03: Advertise app name as Espruino manufacturer data when idle. diff --git a/apps/emojuino/emojuino.js b/apps/emojuino/emojuino.js index 5b7670652..d241063e6 100644 --- a/apps/emojuino/emojuino.js +++ b/apps/emojuino/emojuino.js @@ -32,6 +32,7 @@ const CYCLE_BUZZ_MILLISECONDS = 50; const WELCOME_MESSAGE = 'Emojuino:\r\n\r\n< Swipe >\r\nto select\r\n\r\nTap\r\nto transmit'; // Non-user-configurable constants +const APP_ID = 'emojuino'; const IMAGE_INDEX = 0; const CODE_POINT_INDEX = 1; const EMOJI_PX = 96; @@ -40,12 +41,11 @@ const EMOJI_Y = (g.getHeight() - EMOJI_PX) / 2; const TX_X = 68; const TX_Y = 12; const FONT_SIZE = 24; -const BTN_WATCH_OPTIONS = { repeat: true, debounce: 20, edge: "falling" }; +const ESPRUINO_COMPANY_CODE = 0x0590; const UNICODE_CODE_POINT_ELIDED_UUID = [ 0x49, 0x6f, 0x49, 0x44, 0x55, 0x54, 0x46, 0x2d, 0x33, 0x32 ]; - // Global variables let emojiIndex = 0; let isToggleOn = false; @@ -100,9 +100,22 @@ function transmitEmoji(image, codePoint, duration) { } +// Transmit the app name under the Espruino company code to facilitate discovery +function transmitAppName() { + let options = { + showName: false, + manufacturer: ESPRUINO_COMPANY_CODE, + manufacturerData: JSON.stringify({ name: APP_ID }), + interval: 2000 + } + + NRF.setAdvertising({}, options); +} + + // Terminate the emoji transmission function terminateEmoji(displayIntervalId) { - NRF.setAdvertising({ }); + transmitAppName(); isTransmitting = false; clearInterval(displayIntervalId); drawImage(EMOJIS[emojiIndex][IMAGE_INDEX], false); @@ -169,3 +182,4 @@ g.setFontAlign(0, 0); g.drawString(WELCOME_MESSAGE, g.getWidth() / 2, g.getHeight() / 2); Bangle.on('touch', handleTouch); Bangle.on('drag', handleDrag); +transmitAppName(); From f7a37288264fed375949d90097f6dfeee5781e23 Mon Sep 17 00:00:00 2001 From: jeffyactive Date: Wed, 8 Dec 2021 11:31:52 -0500 Subject: [PATCH 56/94] Added screenshots --- apps.json | 10 +++++++++- apps/sensible/ChangeLog | 1 + apps/sensible/screenshot-acc.png | Bin 0 -> 1093 bytes apps/sensible/screenshot-bar.png | Bin 0 -> 1297 bytes apps/sensible/screenshot-gps.png | Bin 0 -> 1253 bytes apps/sensible/screenshot-hrm.png | Bin 0 -> 1205 bytes apps/sensible/screenshot-mag.png | Bin 0 -> 1281 bytes apps/sensible/screenshot-top.png | Bin 0 -> 2861 bytes apps/sensible/sensible.js | 15 +++++++++++++++ 9 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 apps/sensible/screenshot-acc.png create mode 100644 apps/sensible/screenshot-bar.png create mode 100644 apps/sensible/screenshot-gps.png create mode 100644 apps/sensible/screenshot-hrm.png create mode 100644 apps/sensible/screenshot-mag.png create mode 100644 apps/sensible/screenshot-top.png diff --git a/apps.json b/apps.json index 87f4e5dd2..7e50fd94b 100644 --- a/apps.json +++ b/apps.json @@ -4605,9 +4605,17 @@ "id": "sensible", "name": "SensiBLE", "shortName": "SensiBLE", - "version": "0.02", + "version": "0.03", "description": "Collect, display and advertise real-time sensor data.", "icon": "sensible.png", + "screenshots": [ + { "url": "screenshot-top.png" }, + { "url": "screenshot-acc.png" }, + { "url": "screenshot-bar.png" }, + { "url": "screenshot-gps.png" }, + { "url": "screenshot-hrm.png" }, + { "url": "screenshot-mag.png" } + ], "type": "app", "tags": "tool,sensors", "supports" : [ "BANGLEJS2" ], diff --git a/apps/sensible/ChangeLog b/apps/sensible/ChangeLog index ba597a22f..baa93f297 100644 --- a/apps/sensible/ChangeLog +++ b/apps/sensible/ChangeLog @@ -1,2 +1,3 @@ 0.01: New App! 0.02: Corrected variable initialisation +0.03: Advertise app name, added screenshots diff --git a/apps/sensible/screenshot-acc.png b/apps/sensible/screenshot-acc.png new file mode 100644 index 0000000000000000000000000000000000000000..b286d1ed55b37ccbf406732238425a43630c1dfe GIT binary patch literal 1093 zcmeAS@N?(olHy`uVBq!ia0vp^8$g(Y4M?uv{v-}aaTa()7Bet#3xhBt!>lS)9LmJUYQ@?SKk&qGe7;j^{Vg1f4|6h=P5sEmbO}I zvSiAxTRYxA-}J5Rabj?Xzj8wahjHtJTee*d)^qi@?|QraeEz=YH-FjB|K{ZVefPJT zYwzB__;%x#b=+6BlY5Ux8^!09-oEwu=OpHpTkB`v&p(;1Rhj&zRyKS6>s84!!k1J` zuTxl?7hP@l|7~Q0*m2IS+m25?Zcuri`)%sHtq{qtv~D|*EP z!zO-j-=%KVaJKn13uJ>i1Po+mIPn}#;Bt((DIx*lb4V~YH#isvcT%Cg~eZg-`>si=XF=*yNkz-!|Thg zc-!B$*?aNUtT;DQr!$SwHI40p6TSH#EmQt{as9$odvEP9XKm+yly&5G(xUUmKXq6> zGH>g$T*#caF{r%za@5)|x8=RYVGaMc9{4&@J0^Ph-K=$HaYgf=9sirTlWC9WtwI5I zpm&rLKptf20ebL)&V#k*1%C7}x+P?Yevq6m)wE3cL(q{&OUvu+dd=ipk9x1L{9qFC zQAqE>Qcac?jtZ;iTQBi0WQwy&5H?g~+V)Ih`%GqMmAaL}$}l4pfTja2ao*hUH%Q$L zY!y5#@3O^gGL!o9;`!}Y#|ul2_U>TxcTZYu@a(_^=L6FsRF8-pGCv^vPl4}DBQ)&W z(mokXiO(!v)}+ULkL&W%ltX@sF`dde2Og>7!mIX}v_>cw?Ba=-ap#c&A20&j4q0wE zKQob~Esxpn<$rk&@ekH9%WrasZ>ZpuM#CEKyS9HRnPtwX?m0QXLQuYOxxo8^*ewcg z9Ora!%5Lc3lt;n}`S%WGnjY!{CKCYzo%4-n3k;b+sRkIfpj3kt%&6&zhsh1B1)9iE dlwbSH+#wY7aI&Dpb6^p`;OXk;vd$@?2>@-$<1GLH literal 0 HcmV?d00001 diff --git a/apps/sensible/screenshot-bar.png b/apps/sensible/screenshot-bar.png new file mode 100644 index 0000000000000000000000000000000000000000..781ddbaa63369ebb8dd1966564e486e185c2fea7 GIT binary patch literal 1297 zcmeAS@N?(olHy`uVBq!ia0vp^8$g(Y4M?uv{v-}aaTa()7Bet#3xhBt!>l+Ri(>lQ1BxIMh}lGW%PIRAt`?rtp>==<%FU$Y#&fP!JPWg7jf!^+!i+ksu zI<4w@F>vh=daXV-!0nqJ}&j{KNqtf7d49A?q%@Z-?n$v{mu8k z=53ame{14~G_{58ksO;P?%!s+U+~npi(%(wqsrev&X4Hr8jqBY2AywB_pjA@RHyO& zvfBam`H^Rsn-4HFHcwo5b?MWP{pm^G?|!da&Ru_VInSL98aH=0Tu4%1`peeZcE+!L z?w@y7&ySQpanbJmkrYR37mkJl4z4W~d*hT?j_E#fN$3z@Xk=sp8OO-P%)$mCIe3_u zYd?Hk<1W$I7~gx~|KHay?rmDEI^FxX_Vko(FNF82z6zas!2OZW<@@qZ4^J_^R9b)U zW?=r$x$27_pW6J=HE!zNu>3Da1tfQvonKSGeVT1)${eGq&DGOMzt7Es*Juyf5{v%NwcN`upe#9%`^x%p}NUlhR;o7OMFE`#0 z*WGigY;)zyD4XJE%kE~a+c4*4u-&_Uq4iq&3BLFKvAfDRBs3hTkdSATa7%a)uKeMb zysG|b>#B$MrcK%&_3T#7>(+aV_gTnjH};o3`XqMZ+WHFCRmv_|EJ`|UodWldX-da( z&Z##-=U1ba-gZZ%cksC3OA~~mMQrOvI|J;n0sKN zw2HF1_pXgX|6??Et}I@!(Ea4}rKHnSEkZbRj2&7SICumkK<+eI{$klVR$;LhK@Vna z-PgduC?L__FJL-n=giMJ(GR8^xM&{v?(UA6+0mEuKkW0mXB+74c4hVLCSZDORP44$ z;Aj*L5m00RCQ#9f4`=6Z+G55$J?+7r$%W@St}XJvGd(ZwmB}e5HgLMN6))7CP@4!$ z#NX4{*Hj;vz%={Tp$$xv#Se4&#PMhwR2r^1@Z=~+K>1VWiPw@@FM8`&U+g&`VdYfu zjj2ulkw?!$RyD&m@fk-X;u3_CD;hm}1W)K?n6GV1bO)vsEExrnT|jmdKI;Vst0Om45-v9sr literal 0 HcmV?d00001 diff --git a/apps/sensible/screenshot-gps.png b/apps/sensible/screenshot-gps.png new file mode 100644 index 0000000000000000000000000000000000000000..3fd1229e3d40c9e5a02f2360a165327766af2ed5 GIT binary patch literal 1253 zcmeAS@N?(olHy`uVBq!ia0vp^8$g(Y4M?uv{v-}aaTa()7Bet#3xhBt!>l}XPEYDQ1NDwa z&sR^k$o=~>$ZLLTq~CY*OV4GVR=?KzkYoAL=h~$6yUm|$(>eY4dG3?g{(^-iD-kpTs_|SzhOAb2Wpdje}7@;)S@P-TZ!z#tk*D z2^|6lf^|0pUoe>em#257pRCR{GOs}*yy}<*V3lu1J0*co2nJ8IN^}Q zj4Mp#_A_}H~FFx8V)EJ z7;sE?Q|#OH=BBW;XyxO=#_va>?fJgEJ8ajmPVmrU2SsM)waP7FV!ZNj>ySD3IFmaL*-7-C7)yk}99v&uZRt2bLgN+B=5691w zY`j;qoyBId`O+=X2i@Yn99iOb;s68C`eq>6XqUpfSXOkUyzY;pFLme4_8yzs8}F}B zkT-FcRUD7FVwUJi=6<)1dplB+H5!Y@y_=I%VJ;OXrYKUF+{ICN?bX?aj1NwY=ZiA()MEE<6Ah0_|1j@( z=F&@!tah&$a&1|j`aNG6#&e=iOwncx z50za`F1q8UDxk#tf7=<$pYQr^1lEb{Z2g#i^!>UV{*p&g_f~d&YJDd6{O01+(nngQ zj~Xs8&3@i`fob}heK(ULv`@L5n)LXJM#-!GKj%7kTi^V2>i!hJB{o*aR=?kBac=c< z4s#Z^l1B`{^vniI31@%Q*`=Cp*xGjf+HI+#L#d7HCq(ZIi&_yEB*-4pEAV>n%=EZz4mq{EK&3c%N`!W#Fs)clQ9hd%LdS#?CN`p>l^z#@vl)78&q Iol`;+0KlynVE_OC literal 0 HcmV?d00001 diff --git a/apps/sensible/screenshot-hrm.png b/apps/sensible/screenshot-hrm.png new file mode 100644 index 0000000000000000000000000000000000000000..aa6a0574fd89c1a9443ca8f3ec43454a2ddadd1c GIT binary patch literal 1205 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 BGa&!~ literal 0 HcmV?d00001 diff --git a/apps/sensible/screenshot-top.png b/apps/sensible/screenshot-top.png new file mode 100644 index 0000000000000000000000000000000000000000..e485933f004aa8d87e5f019b21c577b949786435 GIT binary patch literal 2861 zcmds({X5h9AICr28rhI?8zC~n+?;1Z}_w{% z6EDzXojU4e?co3hgTv)Oo-Iq0p--@y@1^u8c#(|-XHQDz)obzk;qesWN~eD z8>r`Y=IdQdCKW@Q3okGEn(v3?L~qx`r2Kj*()HkF$SRrMoT)PsFcP1C%5pONEg(+n z{*Y|qnw?9xf(a6>^ANiL43fzeLW10`xo+X;R*D>=o=1%SbhAY@B#1g% zGl*wz=PG?>hgX?Z^lqNTld@0)-|bfK5BRyBuNZ~!?CsTSHrTE*u9(!Wn-slM+sDdk z7;e_Y(K#bq{7M%3_#qjiFzSM_O-uEEE-B==&>#z|s=itmK>$`kQ?x49MSX(nIVYMI zLhsMCxm#i>d7eS)7%W3L6MoT26+^T5t?7T*e~px}1d;-Vi93Ix!xmW9a7o#{ycD4% z6!B6IL6*L2i`1s-B`cp?1c&Ga0`-#Z#x&c&$zI`$xipfflX#NIo(UVMj+u{sw>W)h zC;&OI=k}YKMWtJ$y8yx9qKVstsLM8K_Pc67JKMrY4PVFPbktrH|zl4nBLZ&D{bo*AOCd&O5IbO}cY=#M7+%1aQ7*MhbvXko8vencD(Ox^3-* z=eYs@MuLIq^1H@4iAX1-hCn{ckfY-zlXEpy^-*WNjv6;j(bUCTUyB6}V$)P zzzwXJqj?D7DR(U&Gl8~+m;#gw{M{UXFXt*fG!9e8^zTs}*A%Pfn%-y;D{%SHKi%zGU=|*Vyz=)e>U}oVH z7I=8YTcSzuJL?o4TE3ATp!aq&!T=B~wQc)drRobh_njuk-D|NQM?tMStht5V1r@xY z1eI7Wc(IF^<)ux+zOuyo>qg{)A4~G>@zTTMc{2PAb<+3}Kr?xu)EFVIIO6%ev{nUR zq_wDdSzRnfb%U`n6tv9*Wt`kZ>RUzGtVVo!{Lc^d$)v#EDK+66)e*xt_AtSQI~ExH z_&b=tTW#YYr&bw|7-37@gp^S&Pv9w0Z)Sh5OUNwsTUwH-MOm)edT~{+UFd86s}4xD zczR@u(Y?=`shh>0vLM~-F0VM$fA{0E@39(FibUU|oGexL6NCJp+{8OYkvea}>v{?# zZQdt#^Pz6$(C;A5c-L0;EuCmfTJ^HVH_P`09`VFQfWa%uVcxV8nO6_v=w^b*2b23< zgp60-N5ekS*srEfghk17HIEal%nT8go?xP3x;d#Jl-*(#?~0Z*6zsc^2gg*dtbJRC zm0j@lNIG$lT$+1TW*+1eb^lSt_Z!pNQ<8$X?zI#5Qj8A*sZCr8oCXiZf3%B`*t41O zAsV+MZE}^y{CqS2KrrH~ZqE^{+5@ir@?~#ULdU6vJU1R-EdLS4iru`g@#E;{Fvd*n ze6(guR0wI(QFyr7tnxkNv20{JWbQ_xs8HO2!XzzZJ{TzLO7ct=H#=E3fpbIrOknk* zj7kB(Bv0jSr~Yz;+J&m%u%K_BvMANyhj7PIAPFN6y;j7#{gTLw z68?n>HF~(-_-wo}&;{~*@^tw4FpR5P{2X3U&cp4^pbXBf@vbPpg{uN_arZ-^0*CmG zl4)YByoiO(3mU+K{N_Q=E9eJ|@>aS`i^ z-^5K9Xx1(_AE{6B9?}0)zw7vScpRx9FC8~*e32wWgJ)hfZp%&N85$o0%AGu(mEwJQ zV3+}?Sa;~N(3#GZEVyV!c1{@EIr=8KYe2m@;6)|FK(|@DI?$lVyf^AsMt*d9^7^C% zPvM1f#(Hp$&J7loE8j^7t9eKC4PKvVn0}wSj)dVVlA32?181h_2;x%qt~9hhAVB*k zyY5^(sOVj4V$*IA0v8m7&(1fg?8ri|fi~4~s8(qxU~wiqCP5tQgY!Ln1_ZP_sz338 z0UUAiMf>SS=nC<0Eu=<&;H+1N32vNF1P9Hk+j7BU%>7U LtWCMKcl>_=8RaYN literal 0 HcmV?d00001 diff --git a/apps/sensible/sensible.js b/apps/sensible/sensible.js index c569ff720..45852adab 100644 --- a/apps/sensible/sensible.js +++ b/apps/sensible/sensible.js @@ -6,6 +6,7 @@ // Non-user-configurable constants const APP_ID = 'sensible'; +const ESPRUINO_COMPANY_CODE = 0x0590; // Global variables @@ -90,6 +91,19 @@ let magMenu = { }; +// Transmit the app name under the Espruino company code to facilitate discovery +function transmitAppName() { + let options = { + showName: false, + manufacturer: ESPRUINO_COMPANY_CODE, + manufacturerData: JSON.stringify({ name: APP_ID }), + interval: 2000 + } + + NRF.setAdvertising({}, options); +} + + // Update acceleration Bangle.on('accel', function(newAcc) { acc = newAcc; @@ -155,6 +169,7 @@ Bangle.on('mag', function(newMag) { // On start: enable sensors and display main menu g.clear(); +transmitAppName(); Bangle.setBarometerPower(isBarEnabled, APP_ID); Bangle.setGPSPower(isGpsEnabled, APP_ID); Bangle.setHRMPower(isHrmEnabled, APP_ID); From b9f636d9dbcd7a58df5b23c0eeb9e2a020e02aec Mon Sep 17 00:00:00 2001 From: crazysaem Date: Wed, 8 Dec 2021 16:37:42 +0000 Subject: [PATCH 57/94] Create Pattern Launcher app --- apps.json | 18 +- apps/ptlaunch/ChangeLog | 1 + apps/ptlaunch/README.md | 46 ++++ apps/ptlaunch/add_pattern.png | Bin 0 -> 2642 bytes apps/ptlaunch/app-icon.js | 1 + apps/ptlaunch/app.js | 416 ++++++++++++++++++++++++++++++++++ apps/ptlaunch/app.png | Bin 0 -> 1094 bytes apps/ptlaunch/boot.js | 194 ++++++++++++++++ apps/ptlaunch/main_menu.png | Bin 0 -> 2840 bytes apps/ptlaunch/select_app.png | Bin 0 -> 2551 bytes 10 files changed, 675 insertions(+), 1 deletion(-) create mode 100644 apps/ptlaunch/ChangeLog create mode 100644 apps/ptlaunch/README.md create mode 100644 apps/ptlaunch/add_pattern.png create mode 100644 apps/ptlaunch/app-icon.js create mode 100644 apps/ptlaunch/app.js create mode 100644 apps/ptlaunch/app.png create mode 100644 apps/ptlaunch/boot.js create mode 100644 apps/ptlaunch/main_menu.png create mode 100644 apps/ptlaunch/select_app.png diff --git a/apps.json b/apps.json index e5d6dad8a..89b46e301 100644 --- a/apps.json +++ b/apps.json @@ -4800,6 +4800,22 @@ "screenshots":[ { "url":"screenshot.png" } ] + }, + { + "id": "ptlaunch", + "name": "Pattern Launcher", + "shortName": "Pattern Launcher", + "version": "0.01", + "description": "Directly launch apps from the clock screen with custom patterns.", + "icon": "app.png", + "tags": "tools", + "supports": ["BANGLEJS2"], + "readme": "README.md", + "storage": [ + { "name": "ptlaunch.app.js", "url": "app.js" }, + { "name": "ptlaunch.boot.js", "url": "boot.js" }, + { "name": "ptlaunch.img", "url": "app-icon.js", "evaluate": true } + ], + "data": [{"name":"ptlaunch.patterns.json"}] } - ] diff --git a/apps/ptlaunch/ChangeLog b/apps/ptlaunch/ChangeLog new file mode 100644 index 000000000..4967d3207 --- /dev/null +++ b/apps/ptlaunch/ChangeLog @@ -0,0 +1 @@ +0.01: Initial creation of the pattern launch app \ No newline at end of file diff --git a/apps/ptlaunch/README.md b/apps/ptlaunch/README.md new file mode 100644 index 000000000..a69492782 --- /dev/null +++ b/apps/ptlaunch/README.md @@ -0,0 +1,46 @@ +# Pattern Launcher + +Directly launch apps from the clock screen with custom patterns. + +## Usage + +Create patterns and link them to apps in the Pattern Launcher app. + +Then launch the linked apps directly from the clock screen by simply drawing the desired pattern. + +## Screenshots and detailed steps + +![](main_menu.png) +![](add_pattern.png) +![](select_app.png) + +From the main menu you can: +- Add a new pattern and link it to an app (first entry) + - To create a new pattern first select "Add Pattern" + - Now draw any pattern you like, this will later launch the linked app from the clock screen + - If you don't like the pattern, simply re-draw it. The previous pattern will be discarded. + - If you are happy with the pattern tap on screen or press the button to continue + - Now select the app you want to launch with the pattern. + - Note, you can bind multiple patterns to the same app. +- Remove linked patterns (second entry) + - To remove a pattern first select "Remove Pattern" + - You will now see a list of apps that have patterns linked to them + - Simply select the app that you want to unlink. This will remove the saved pattern, but not the app itself! + - Note, that you can not actually preview the patterns. This makes removing patterns that are linked to the same app annoying. sorry! +- Disable the lock screen on the clock screen from the settings (third entry) + - To launch the app from the pattern on the clock screen the watch must be unlocked. + - If this annoys you, you can disable the lock on the clock screen from the setting here + +## FAQ + +1) Nothing happens when I draw on the clock screen! + +Please double-check if you actually have a pattern linked to an app. + +2) I have a pattern linked to an app and still nothing happens when I draw on the clock screen! + +Make sure the watch is unlocked before you start drawing. If this bothers you, you can permanently disable the watch-lock from within the Pattern Launcher app (via the Settings). + +3) I have done all that and still nothing happens! + +Please note that drawing on the clock screen will not visually show the pattern you drew. It will start the app as soon as the pattern was recognized - this might take 1 or 2 seconds! If still nothing happens, that might be a bug, sorry! diff --git a/apps/ptlaunch/add_pattern.png b/apps/ptlaunch/add_pattern.png new file mode 100644 index 0000000000000000000000000000000000000000..c7cc38e82c25b4661bc026ce7dd5901c77fb9f7f GIT binary patch literal 2642 zcma);c{tSDAIHD57-P+39c!Yg3>vAZAxlIOmm4y&B*G|E3{vi>Tx6-a-A2l&Ye~Y` z#S9vfwL4>PEW=o`32e=Lf|waw@c6NPrhId|^(JciJD@iVsy*Xc@rx|;~o zEF%A%n%L0jZ6gL5rfGW?R$m+z8c}MN1X@4V<1p}+ci>g@;Ia&LNDxBwP<^X-0Q46x zn@aO|fc}10l1o7~JzQqHM-Dcs`LqhO83;!ksAtp!m6pfAE^gTob+Sy+9bm3#-;AB! zI>10&$VTLg)fMyKu4b57h?!QV=vb)|>AVctm4hrHklk#vCz;M;f>)l+K{vCI;1W;z z5GAfb?Yk7$5rrd6QfXCD6UHnF%qFIb<|Bwj6>m=sr*4RI)2#Jr5gr^*`bzI@u(a6@ zvS1sh5O$bo9Ic(6Nh^pdMV0@F(Jy~D=6f>(ez*hN(mM80Ooj!h;# zBfHp`U?VWW6CbV8bQuZhQ0r+Wu)X`h8B$B2cm{8O%#r6BrsX8d;3bA-Wv*tItok4l zW7uj>@Wa$w?FkZ>#Y^v1a;+PK=wx}{)%VxMuKM53eluMq=ak}oT;H{N#mMcD-|5d! zH?OQKr$L{yAZ2*6p+L?LyaXP4XC<*}49VKCah0#~C51+M^fG_pIX3J;G2RP>q%|D> zDB((JiYJzo$d??E!1!LT#M8r0u;SLfae`UZ*KqerXyI+oHm2#ll?I2&XZQM5!4^*S z$Z_@Myjors$;Zw!mrhRf#Lp{}uocP;NXbnH>@Pag0nMrK3X=ws_D(+KgKK2P)l}%3 zUW|^lS>I`>Y1dA$ZtHZHHnV=5g18VNh#h)g z(Jccd;5ep-Mf&`CSyL`_DkYZ!pxu)Wp&Y{hcm}$p6Y$3P(qjwbxwN8@Is)XMp5(UG zuJek^6B=x=vUZ-#8Fj|fU7Jt|B4+o)Z1Hj|^ z$a{ujk&&AIx_Cw~Ka17)?fyI&Y}RM;s2M#0jhRWCoP)A4S*$4Se_k9gho49OX;Uc%z zcIuVop(+v0-Ozmx`_FikKyk|>g0fpSM9`fEN5Fa?BT4$XnN$V-W5(sLOv?nr0tDzR zeFc4_xF&9fZ-fHnX#a>!OOjyxh2mraXwBTFvGzkd=&9px^5sM5Pn1qa?o@5*(hT^? zuLZbZbFT$k4HcRAfa*lkbB^;3zn#qGNRSBJ-V-+y+cSYYMdY9M7tG+TFJhU}XJ>1d znv~@7>U;2wdi#1UqH>$#JPJ{ox)m>C;j7cXW^yLFr7}0H*@-7LJHdL;shc*T8Rb3c z)P~UC(}QBaI1#mc?Nl$@Wb}u{K|wpOoSW2^JKa#prQ8~})F}CDOtr=Pqgq0DVLZ-5 zN7RjL(^bIPwojszc_r8?Len2V%JH`RR!!TNf!`bZm=hhQ!vx!hY_;)@?Mdg6Ewruj z7a7t%AF*(oWV;bj4Ge3gKTIq0UDMfb*>ENr#VQ2G4T3XMC{aPZr)5?%z6KtwYmaZN zRI}@AR1LU@m0p#6;)2+mwT%DuUyrk%kCA6z`qriIn23%yWT?;PFpL}+E~O8+6BXvc8Rz27U%_Gu z5^yeLAbPM-^>WeN&%nyDwFB4NYjcbFoYnm~dq5d}`}cRe+a?TZh>d%)w(v#rQ##Gq z(11@ZlwM}$wnp}2_(~c{2?!d9my8I|&bcO1-WZK=OAGp9b@$A+u@{p2U2puesIh~b zzN=|#P4wgx?KPmgh%i_y`-+bc@)+LfOYi6k4CICC`4$lc6F26!oW=S001r+9z`UOO zMk;!cqA?!L`hbnteQFd#$#+}jv34vw2~c}k9#fYzx5P+&8fH%U4;x39*B1+~mC85V zGW#zdoroUf=d8>2lkN*mWsZCOwBC?29Eh23M#GP`b~tn&%6+N9er)l*BbfxfMB&Rp zBBT&4FmE~g$x6uLt>rr>M8qpER_ulaiTjZ8A5xx(sJSk%GC#U|eu|?F^Anf7^1u+D zA2FN|RZlQiGx|+~J@_c_fxt64uxLFCet2X9uBU*}nyt4W{8TT5V_u0nUBG})45(=c zEWTE5xXiJ@`)w6pZ)D4vlCshKqQyWw!rcldk6om`rW`p@&v9+UE!23|92&a?1jz>k z`Ui1_YXo28S!D7;TT|d98Dg5cFH|IFmQccjEyf_}V=3m3PIQ0i_88exLmo6))3IKX zSwYJTR|`BI88#(83YhsH9FF$Dyvm#=O;Rg>oCuE-qPjb9j*v8h)>=1{T!Zn{Cw$&O${zCa@K+7^18G} a2vKOb@;L{iZz}pE0_SX { + if (DEBUG) { + console.log(JSON.stringify(message)); + } +}; + +var CIRCLE_RADIUS = 25; +var CIRCLE_RADIUS_2 = CIRCLE_RADIUS * CIRCLE_RADIUS; + +var CIRCLES = [ + { x: 25, y: 25, i: 0 }, + { x: 87, y: 25, i: 1 }, + { x: 150, y: 25, i: 2 }, + { x: 25, y: 87, i: 3 }, + { x: 87, y: 87, i: 4 }, + { x: 150, y: 87, i: 5 }, + { x: 25, y: 150, i: 6 }, + { x: 87, y: 150, i: 7 }, + { x: 150, y: 150, i: 8 }, +]; + +var showMainMenu = () => { + log("loading patterns"); + var storedPatterns = storage.readJSON("ptlaunch.patterns.json", 1) || {}; + + var mainmenu = { + "": { + title: "Pattern Launcher", + }, + "< Back": () => { + log("cancel"); + load(); + }, + "Add Pattern": () => { + log("creating pattern"); + createPattern().then((pattern) => { + log("got pattern"); + log(pattern); + log(pattern.length); + + var confirmPromise = new Promise((resolve) => resolve(true)); + + if (!!storedPatterns[pattern]) { + log("pattern already exists. show confirmation prompt"); + confirmPromise = E.showPrompt("Pattern already exists\nOverwrite?", { + title: "Confirm", + buttons: { Yes: true, No: false }, + }); + } + + confirmPromise.then((confirm) => { + log("confirmPromise resolved: " + confirm); + if (!confirm) { + showMainMenu(); + return; + } + + log("selecting app"); + getSelectedApp().then((app) => { + E.showMessage("Saving..."); + log("got app"); + log("saving pattern"); + + storedPatterns[pattern] = { + app: { name: app.name, src: app.src }, + }; + storage.writeJSON("ptlaunch.patterns.json", storedPatterns); + showMainMenu(); + }); + }); + }); + }, + "Remove Pattern": () => { + log("selecting pattern through app"); + getStoredPatternViaApp(storedPatterns).then((pattern) => { + E.showMessage("Deleting..."); + delete storedPatterns[pattern]; + storage.writeJSON("ptlaunch.patterns.json", storedPatterns); + showMainMenu(); + }); + }, + Settings: () => { + var settings = storedPatterns["settings"] || {}; + + var settingsmenu = { + "": { + title: "Pattern Settings", + }, + "< Back": () => { + log("cancel"); + load(); + }, + }; + + if (settings.lockDisabled) { + settingsmenu["Enable lock"] = () => { + settings.lockDisabled = false; + storedPatterns["settings"] = settings; + Bangle.setOptions({ lockTimeout: 1000 * 30 }); + storage.writeJSON("ptlaunch.patterns.json", storedPatterns); + showMainMenu(); + }; + } else { + settingsmenu["Disable lock"] = () => { + settings.lockDisabled = true; + storedPatterns["settings"] = settings; + storage.writeJSON("ptlaunch.patterns.json", storedPatterns); + Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 }); + showMainMenu(); + }; + } + + E.showMenu(settingsmenu); + }, + }; + E.showMenu(mainmenu); +}; + +var drawCircle = (circle) => { + g.fillCircle(circle.x, circle.y, CIRCLE_RADIUS); +}; + +var positions = []; +var createPattern = () => { + return new Promise((resolve) => { + E.showMenu(); + g.clear(); + g.setColor(0, 0, 0); + CIRCLES.forEach((circle) => drawCircle(circle)); + + var pattern = []; + + var isFinished = false; + var finishHandler = () => { + if (pattern.length === 0 || isFinished) { + return; + } + log("Pattern is finished."); + isFinished = true; + Bangle.removeListener("drag", dragHandler); + Bangle.removeListener("tap", finishHandler); + resolve(pattern.join("")); + }; + setWatch(() => finishHandler(), BTN); + setTimeout(() => Bangle.on("tap", finishHandler), 250); + + var dragHandler = (position) => { + positions.push(position); + + debounce().then(() => { + if (isFinished) { + return; + } + E.showMessage("Calculating..."); + var t0 = Date.now(); + + log(positions.length); + + var circlesClone = cloneCirclesArray(); + pattern = []; + + var step = Math.floor(positions.length / 100) + 1; + + var p, a, b, circle; + + for (var i = 0; i < positions.length; i += step) { + p = positions[i]; + + circle = circlesClone[0]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(0, 1); + } + } + + circle = circlesClone[1]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(1, 1); + } + } + + circle = circlesClone[2]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(2, 1); + } + } + + circle = circlesClone[3]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(3, 1); + } + } + + circle = circlesClone[4]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(4, 1); + } + } + + circle = circlesClone[5]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(5, 1); + } + } + + circle = circlesClone[6]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(6, 1); + } + } + circle = circlesClone[7]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(7, 1); + } + } + + circle = circlesClone[8]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(8, 1); + } + } + } + var tx = Date.now(); + log(tx - t0); + positions = []; + var t1 = Date.now(); + log(t1 - t0); + + log("pattern:"); + log(pattern); + + log("redrawing"); + g.clear(); + g.setColor(0, 0, 0); + CIRCLES.forEach((circle) => drawCircle(circle)); + + g.setColor(1, 1, 1); + g.setFontAlign(0, 0); + g.setFont("6x8", 4); + pattern.forEach((circleIndex, patternIndex) => { + var circle = CIRCLES[circleIndex]; + g.drawString(patternIndex + 1, circle.x, circle.y); + }); + var t2 = Date.now(); + log(t2 - t0); + }); + }; + + Bangle.on("drag", dragHandler); + }); +}; + +var getAppList = () => { + var appList = storage + .list(/\.info$/) + .map((appInfoFileName) => { + var appInfo = storage.readJSON(appInfoFileName, 1); + return ( + appInfo && { + name: appInfo.name, + // type: appInfo.type, + // icon: appInfo.icon, + sortorder: appInfo.sortorder, + src: appInfo.src, + } + ); + }) + .filter((app) => app && !!app.src); + appList.sort((a, b) => { + var n = (0 | a.sortorder) - (0 | b.sortorder); + if (n) return n; // do sortorder first + if (a.name < b.name) return -1; + if (a.name > b.name) return 1; + return 0; + }); + + return appList; +}; + +var getSelectedApp = () => { + E.showMessage("Loading apps..."); + return new Promise((resolve) => { + var selectAppMenu = { + "": { + title: "Select App", + }, + "< Cancel": () => { + log("cancel"); + showMainMenu(); + }, + }; + + var appList = getAppList(); + appList.forEach((app) => { + selectAppMenu[app.name] = () => { + log("app selected"); + log(app); + resolve(app); + }; + }); + + E.showMenu(selectAppMenu); + }); +}; + +var getStoredPatternViaApp = (storedPatterns) => { + E.showMessage("Loading patterns..."); + log("getStoredPatternViaApp"); + return new Promise((resolve) => { + var selectPatternMenu = { + "": { + title: "Select App", + }, + "< Cancel": () => { + log("cancel"); + showMainMenu(); + }, + }; + + log(storedPatterns); + var patterns = Object.keys(storedPatterns); + log(patterns); + + patterns.forEach((pattern) => { + if (!!pattern) { + if (!!storedPatterns[pattern]) { + var app = storedPatterns[pattern].app; + if (!!app && !!app.name) { + var appName = app.name; + var i = 0; + while (appName in selectPatternMenu[app.name]) { + appName = app.name + i; + i++; + } + selectPatternMenu[appName] = () => { + log("pattern via app selected"); + log(pattern); + log(app); + resolve(pattern); + }; + } + } + } + }); + + E.showMenu(selectPatternMenu); + }); +}; + +showMainMenu(); + +////// +// lib functions +////// + +var debounceTimeoutId; +var debounce = (delay) => { + if (debounceTimeoutId) { + clearTimeout(debounceTimeoutId); + } + + return new Promise((resolve) => { + debounceTimeoutId = setTimeout(() => { + debounceTimeoutId = undefined; + resolve(); + }, delay || 500); + }); +}; + +var cloneCirclesArray = () => { + var circlesClone = Array(CIRCLES.length); + + for (var i = 0; i < CIRCLES.length; i++) { + circlesClone[i] = CIRCLES[i]; + } + + return circlesClone; +}; diff --git a/apps/ptlaunch/app.png b/apps/ptlaunch/app.png new file mode 100644 index 0000000000000000000000000000000000000000..14ed77f1d36f5f5c0b0c01f7da79c9b736431595 GIT binary patch literal 1094 zcmV-M1iAZ(P)Px#1ZP1_K>z@;j|==^1poj60#Hm;MgRZ*(b3UgUtb^~AOHXWCMG6jWo6sj+s4Mm zSy@>b85t}rENg3P=H}-8{rz@!b_NCp2nYy?iHZCB`(tBc1Ox;N3k#l}o{f!-prD`) z4GrPp;lRMa6B85i^70}gB1lL`aBy(U%*;18Hx(5XPEJmRg@r~&Mi&gxIV`Eqh{v9YmwdU~_7v)S3%FfcGfLqmgugYfY1 z_xJZfK|vlK9!yM30s;b$kB>h;KZ}ct?Ck7*etw6ChiPePTU%SHsi}B)c&n?cmX?;9 znwk#}55mI2U0q$dxw)8_m?|nNP*6~Afhs%z000SaNLh0L01m?d01m?e$8V@)0008b zNkl^bI~=1WhX z4>0d+CfV%H%!YuIagE95^44aS3Z5~`E2}Dr^0}-rZpLA;RxBCDFSDlgjZJY>w!}eY zUmT_48dOn)rOLw@RmN=A*ilspikOeRzbhBjw=ulKrm)+9W4o>jlpMa_tFj{+H=w4N zf_>(*DHxL>ysz8Z(||Tnqa&u!ML=6^#wGk@UiUO0APU7&A_N3#3pT)*Gyz!PML?fu zA6u|sfPlW*OqO!Syn&baQA7N9c|bXUW2iQhqr7h_fd%UD2;+M)!g$AU9383xKGLDA zHjsTfQH51MWk*dV;AE)k#vID^L}!`_osl|f`i#1y0&N%DLC_!C`3U3Ic@SJ&+HDq& zhW#LD7i}W^D;iYTU2;zm#tV3<60B1ZLUvKX2*>R>4Y@mL%9xc9|#0bW_$%OA(e}H4G+hW;V zqJo-C3**b%mo(p#+b<$q&wI469O)HNLi*8wU|qc4-kMqncG(wmpr7b z&}v0Z(6PHeR$*~% { + if (DEBUG) { + console.log(JSON.stringify(message)); + } +}; + +var CIRCLE_RADIUS = 25; +var CIRCLE_RADIUS_2 = CIRCLE_RADIUS * CIRCLE_RADIUS; + +var CIRCLES = [ + { x: 25, y: 25, i: 0 }, + { x: 87, y: 25, i: 1 }, + { x: 150, y: 25, i: 2 }, + { x: 25, y: 87, i: 3 }, + { x: 87, y: 87, i: 4 }, + { x: 150, y: 87, i: 5 }, + { x: 25, y: 150, i: 6 }, + { x: 87, y: 150, i: 7 }, + { x: 150, y: 150, i: 8 }, +]; + +var storedPatterns; +var positions = []; +var dragHandler = (position) => { + positions.push(position); + + debounce().then(() => { + log(positions.length); + + var circlesClone = cloneCirclesArray(); + var pattern = []; + + var step = Math.floor(positions.length / 100) + 1; + + var p, a, b, circle; + + for (var i = 0; i < positions.length; i += step) { + p = positions[i]; + + circle = circlesClone[0]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(0, 1); + } + } + + circle = circlesClone[1]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(1, 1); + } + } + + circle = circlesClone[2]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(2, 1); + } + } + + circle = circlesClone[3]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(3, 1); + } + } + + circle = circlesClone[4]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(4, 1); + } + } + + circle = circlesClone[5]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(5, 1); + } + } + + circle = circlesClone[6]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(6, 1); + } + } + circle = circlesClone[7]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(7, 1); + } + } + + circle = circlesClone[8]; + if (circle) { + a = p.x - circle.x; + b = p.y - circle.y; + if (CIRCLE_RADIUS_2 - (a * a + b * b) >= 0) { + pattern.push(circle.i); + circlesClone.splice(8, 1); + } + } + } + positions = []; + + pattern = pattern.join(""); + + if (!!pattern) { + if (!!storedPatterns[pattern]) { + var app = storedPatterns[pattern].app; + if (!!app && !!app.src) { + Bangle.removeListener("drag", dragHandler); + load(app.src); + } + } + } + }); +}; + +var debounceTimeoutId; +var debounce = (delay) => { + if (debounceTimeoutId) { + clearTimeout(debounceTimeoutId); + } + + return new Promise((resolve) => { + debounceTimeoutId = setTimeout(() => { + debounceTimeoutId = undefined; + resolve(); + }, delay || 500); + }); +}; + +var cloneCirclesArray = () => { + var circlesClone = Array(CIRCLES.length); + + for (var i = 0; i < CIRCLES.length; i++) { + circlesClone[i] = CIRCLES[i]; + } + + return circlesClone; +}; + +(function () { + var sui = Bangle.setUI; + Bangle.setUI = function (mode, cb) { + sui(mode, cb); + if (!mode) { + Bangle.removeListener("drag", dragHandler); + storedPatterns = {}; + return; + } + if (!mode.startsWith("clock")) { + storedPatterns = {}; + Bangle.removeListener("drag", dragHandler); + return; + } + + var storage = require("Storage"); + storedPatterns = storage.readJSON("ptlaunch.patterns.json", 1) || {}; + if (Object.keys(storedPatterns).length > 0) { + Bangle.on("drag", dragHandler); + if (storedPatterns.settings.lockDisabled) { + Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 }); + } + } + }; +})(); diff --git a/apps/ptlaunch/main_menu.png b/apps/ptlaunch/main_menu.png new file mode 100644 index 0000000000000000000000000000000000000000..a4ecebb0f4ba586eba902bf1699e9b5f9dbe683a GIT binary patch literal 2840 zcmds3dpr|-7yr#-PjgG9o-ke1Qy$&Kw2i39LhdHHCAYb3%xyd`x%9lsWeut17PVY* zk8+tyE4hRwqQW*qh1lkjjj-N5f4+ad|Gs~mbN>0B&*yy3`F_ti$u?G4dAJH303dI6 z(Zo&?YyPp{WF)@2;fuQ@K*H>>=Rp-yZ59Cdpqa@zhbVVm{scW2C1-M4@az4^38Mej zj)xh?lI}eekG)9mqWw+UH(~g&e|p(SJaN_*rVd=6hjxo67^;l4E?S_4X&vXAO%tne z_`4IXVQMNRP+xjguIlJwkosw+wwU>#jE+cibj_7tNF#5S8<+D(blTrdbfP=Q_t;DD z11W(}kCM=Y2g<2x>ErTlAw+v1685bh=kY7qjqkoXZj7+Te$63vkNsCVf(uI3Jgz`uuKF|0)JS$DUj^X<+G zbMNBdBK~0TkdZ2vG->*ZZ7^_PUY-|0|e4vjsmyY^!sv52Yaf;BL9@KX(tWcQ$S80rkGIw632%@H~D`mFD zW151)XpH8$T2bmcKl*%J17*4<9(z}?{z+eW`CEjy8nb&>lbjlKp6VEUxOg~g2b3Ye zrAC>;_}i)}4pReXYI=6h-W~SD=8VqbYc?AO?mo&m&g%Kfd^E{Ys9Z9kgomQF`FUNg zR|3h)^pHv|^ZOi&`fb>ON;6i8jz&oCIeggOf)=0oECeb#M~J~bbl~g9^amF$6IzOz zMQ{52{YH@AgZ2-_-U(52dIxEH-{ySb{fN)2+pqim7l zGp>!jX%+efLxPib$|zTN>f8_SQrm-hn=!|@3ew^Wss63|rU;t+_5JQ$biq-ZpP|PN zjpZxIy;LQhI2EYKik|3HB8V!r8PSKWMExtO-0bssPU7b|n;eG_bZ53f(4vV z_Ts{q4;^0O_HlDZ(hE8J!V7e-gL=@IeWg4GPn4i@O~Br2yF7GU^?O|K1<{E{a`0^g z&%VZl9^hLsC@r&sSnZD7e<1Rh^D`E#O7UtZ+)zl=oj(3=y4S1BM!78k)9K)oyZZN+ zYzPnw;c;s}!D_GU2Co;&4X$3usunB?^WU7fdbD@l5C&G)1Abap&LFs5bHQzS8__ai zg}(dk=+0!K|EM=+x%3VOdtj*A)3@KKUoI&`Q$^oK1zB#E zL9F7jHMNO=*xB360yAuas~5lui!wgzv_A$7mkNd_!UIHMZw!NcuYdn61(@a(XvL-8 zKbg;H`D~(%Gb@PyEgQX+856>Pa)cNVb3eT!tr|+|?d~S(HW<4PbhrSmO}GuR4HaLv z#DO@D2%~H7FGi9*q;q6jWzUgejtfkJi^H*(-Yr%za!MsU77KIqKv{Ye80WhNxXx-C zirqlDCkIj!_E<9?5DFYY1-)L@{*Sx-JSCpq_7_qRl+>#}b(ECPLA}t)A{<130*TJy`w++nFR%M@FE1@4t_N@0PSb}VXL^%*`@vJ@z)BULxbZy3$J63 zF3^~RvnE|A}3bN zimks$J79D@&-tZFCZi&9(S}7HoU%I7eN&5y$AxoyCU! zsE4n z_>8`CkLj+F^6}clirST6jb`i~HTr6>T#S+^O7G4Wd&$Nv$-{GY!T_qn^iE8VMD2H% z`*J5GXS-4$UpjV)x?SXWcgOS_R8G=U0V6mbA6%oQH^) z3B+VY>FNiFESFN$^u8%%PfoY(c*3>#{LN4;-#Xr^Q=Jc9i+MffXV07=ogJ9;y*$mh zRap*VP4xnx}rc~ni z0(;fA+r@A=V;uIjN9&H_De76Ng`Te)qUUDuE?HN7hG(p!hqi`_c6k~V{7ippaLwSK zDrnZzYA0Ptn03-UquOd*)8lC2Mr}q&7>Kua0$j}DqzKhxgRRaMk&j4|{1(|q=Cd<6 z^zVBk&vHytU)xO_HwiAUja%LR*MLR11=9T#HD>JfnMkG}wLvk(u*2@e%I|MmZ_PTr zwteqB$6i`K7_^z$F$%4INpVdi$cApVoKgkWu}RIfs4pKS9e<@kufFM9loYp%%MoWO zdTZ?;{j}6CwIPPZn26|HNE*ZpIWGOBJIp}{W88n8kZBt~NwD~`S zI^7j4M#Vg5Nd8FLa}j#}@9KCzpTe z#znutBS_e)1B5|YY^XuRM1Gnf+y&Vyl`Xd?8)u$mDFS=q(ra2ZfI!FNTmUGk%lHJ+ zQt&hdgr#2%X~0!hzY-7=zIt4bd0M{~4CD`CZYl<9{RgRa~^oOf5|p8p;x#l(U*nIY?Cl zD~SX_93w8ve|eMBj$Qb?q$p1D7^Q|cpL<8C{}`UwSfY~g>c@Lg=qr-(M)r zF3ujW=|CSM-1wdr0>vPnvirt>MaMyE6fB4`vOZHCgbjFr{{4?{0nipuU3dNEDRi>K z1`#j%Y+LrKI*2qBvqpxRlUUgsq9zLz5Avf?-_L4gH<~vz%vR>@UfH<%s;gb+#<(F+SNN004nhIv%nE-uEpzxK6@n5orbKj;3@cNeJ4`i1zHkPimn z+NBzRxPKuF1++PaLjl{`L?acUMW!#S?Sg?X2`{PJG3-*h?tWjeY<*Aq!I5rdtX}|r zvnmuI^Lhq`jo`w1{)#1R*H66J_=PWtmqdmn312p<7rhqhn~+g<6+*tnjW~je{*%^I z>)*srA8T9aEj_0rl$1@qdld#E@4WLqtCv;d{bC0|;(>mk15-~f!vZP5ynPT(WpdeA zG4N&XsvfchoIxk9e|cEWzz(d)?{P)flLK^Ty)o*66z}em&qK-?FJ`*@Qr4ZHoghcqW>3?Q zJ|5TZhHO3~glllX83Yhc{`@-;3d9pB$A9wxm>StBL;?u#7wPQqQjbY4_0pa*{=I#D z;CYTXb?I{ZWLfDG`}ZhZZ`|u?Nv@rPbW!_#=V$5 zYgN^fbq4fbE64FcreCCY6*@|KjluN!Hq>V&;-ta8h{ZMM?y&g8l43yMQDv=>R zrPA?7vFgv1_Fa!_R}vH->m}K2VFMa|oecNJGDMtz&T60(D z8G3il>_QqmweGYg7~R=U%c1p$b0juSuwJdvd(AU!vU!T1qF8Q&ldn&iFkRIMHY0iW zZ8pHhXfH6YSTuPxK_=@Ut&kbIOfv|YC z(mTTSXmp?GJAC;(^0VR~?)9M!%0lPZPU|T~<)Da>6V}BT)tBtm(~BqkW-KNGOL*KzMLpISO0PgLO&tmir|az0xy%%KG{ye~P9G8DJpuILJ$q&OdhciiV-&~L54 zR9O){pY*0E?vtI|>dU#WM2>#>u`wQnwlMucV$GNx?fD7AE0lUw6l4mK$Oww zvEKDzn|z0GaNA4vsy05V%~B}>8jhgc(0G9P%k0e3&}~L!ILG~bo=Z$1J|8hcyJK~%~^FVP|C-3 zqqgNv;GiR|ZrUdZSKO|71r^fH`I|$HnAqD7oJu; Date: Wed, 8 Dec 2021 20:44:25 +0000 Subject: [PATCH 58/94] ptlaunch: fix undefined error on boot.js if a pattern was saved but no setting was defined --- apps/ptlaunch/boot.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/apps/ptlaunch/boot.js b/apps/ptlaunch/boot.js index 2440c561f..f30cb2921 100644 --- a/apps/ptlaunch/boot.js +++ b/apps/ptlaunch/boot.js @@ -186,8 +186,10 @@ var cloneCirclesArray = () => { storedPatterns = storage.readJSON("ptlaunch.patterns.json", 1) || {}; if (Object.keys(storedPatterns).length > 0) { Bangle.on("drag", dragHandler); - if (storedPatterns.settings.lockDisabled) { - Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 }); + if (storedPatterns.settings) { + if (storedPatterns.settings.lockDisabled) { + Bangle.setOptions({ lockTimeout: 1000 * 60 * 60 * 24 * 365 }); + } } } }; From bbef0ded3f2fccb8e430a80c95d1e9c2ecb5b3b5 Mon Sep 17 00:00:00 2001 From: crazysaem Date: Wed, 8 Dec 2021 20:52:46 +0000 Subject: [PATCH 59/94] ptlaunch: fix eslint errors --- apps/ptlaunch/app.js | 6 +++--- apps/ptlaunch/boot.js | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/ptlaunch/app.js b/apps/ptlaunch/app.js index 07b471273..8ba1adf81 100644 --- a/apps/ptlaunch/app.js +++ b/apps/ptlaunch/app.js @@ -43,7 +43,7 @@ var showMainMenu = () => { var confirmPromise = new Promise((resolve) => resolve(true)); - if (!!storedPatterns[pattern]) { + if (storedPatterns[pattern]) { log("pattern already exists. show confirmation prompt"); confirmPromise = E.showPrompt("Pattern already exists\nOverwrite?", { title: "Confirm", @@ -360,8 +360,8 @@ var getStoredPatternViaApp = (storedPatterns) => { log(patterns); patterns.forEach((pattern) => { - if (!!pattern) { - if (!!storedPatterns[pattern]) { + if (pattern) { + if (storedPatterns[pattern]) { var app = storedPatterns[pattern].app; if (!!app && !!app.name) { var appName = app.name; diff --git a/apps/ptlaunch/boot.js b/apps/ptlaunch/boot.js index f30cb2921..1433f1700 100644 --- a/apps/ptlaunch/boot.js +++ b/apps/ptlaunch/boot.js @@ -131,8 +131,8 @@ var dragHandler = (position) => { pattern = pattern.join(""); - if (!!pattern) { - if (!!storedPatterns[pattern]) { + if (pattern) { + if (storedPatterns[pattern]) { var app = storedPatterns[pattern].app; if (!!app && !!app.src) { Bangle.removeListener("drag", dragHandler); From 26cb1e58a6322b7c976038d33d8f8197b335053f Mon Sep 17 00:00:00 2001 From: ps-igel <60899838+ps-igel@users.noreply.github.com> Date: Wed, 8 Dec 2021 23:17:06 +0100 Subject: [PATCH 60/94] enhance for use with Bangle2, add new draw mode --- apps.json | 3 +-- apps/numerals/ChangeLog | 1 + apps/numerals/README.md | 14 +++++++--- apps/numerals/numerals.app.js | 41 ++++++++++++++++++++++-------- apps/numerals/numerals.settings.js | 4 +-- 5 files changed, 45 insertions(+), 18 deletions(-) diff --git a/apps.json b/apps.json index e5d6dad8a..ef4ec7db6 100644 --- a/apps.json +++ b/apps.json @@ -2086,12 +2086,11 @@ "id": "numerals", "name": "Numerals Clock", "shortName": "Numerals Clock", - "version": "0.09", "description": "A simple big numerals clock", "icon": "numerals.png", "type": "clock", "tags": "numerals,clock", - "supports": ["BANGLEJS"], + "supports": ["BANGLEJS","BANGLEJS2"], "allow_emulator": true, "screenshots": [{"url":"bangle1-numerals-screenshot.png"}], "storage": [ diff --git a/apps/numerals/ChangeLog b/apps/numerals/ChangeLog index f94d719f4..57818c180 100644 --- a/apps/numerals/ChangeLog +++ b/apps/numerals/ChangeLog @@ -7,3 +7,4 @@ 0.07: Add date on touch and some improvements (see settings and readme) 0.08: Add new draw styles, tidy up draw functionality 0.09: Tweak for faster rendering +0.10: Enhance for use with Bangle2, insert new draw mode 'thickfill' \ No newline at end of file diff --git a/apps/numerals/README.md b/apps/numerals/README.md index ebf4c10fe..7a8c25212 100644 --- a/apps/numerals/README.md +++ b/apps/numerals/README.md @@ -7,14 +7,20 @@ Settings can be accessed through the app/widget settings menu of the Bangle.js ### Color: * rnd - shows numerals in different color combinations every time the watches wakes -* r/g - red/green -* y/w - yellow/white -* o/c - orange/cyan -* b/y - blue/yellow'ish +* r/g - red/green (Bangle1/Bangle2) +* y/w - yellow/white (Bangle1 only) +* o/c - orange/cyan (Bangle1 only) +* b/y - blue/yellow'ish (Bangle1 only) +* r/g - red/green (Bangle2 only) +* g/b - green/blue (Bangle2 only) +* r/c - red/cyan (Bangle2 only) +* m/g - magenta/green (Bangle2 only) ### Draw mode * fill - fill numerals * frame - only shows outline of numerals +* framefill - frame with lighter color fill +* thickfill - thick frame in theme foreground color ### Menu button * choose button to start launcher menu with diff --git a/apps/numerals/numerals.app.js b/apps/numerals/numerals.app.js index 3c7607eb1..baf859915 100644 --- a/apps/numerals/numerals.app.js +++ b/apps/numerals/numerals.app.js @@ -6,7 +6,7 @@ * + see README.md for details */ -var numerals = { + var numerals = { 0:[[9,1,82,1,90,9,90,92,82,100,9,100,1,92,1,9],[30,25,61,25,69,33,69,67,61,75,30,75,22,67,22,33]], 1:[[50,1,82,1,90,9,90,92,82,100,73,100,65,92,65,27,50,27,42,19,42,9]], 2:[[9,1,82,1,90,9,90,53,82,61,21,61,21,74,82,74,90,82,90,92,82,100,9,100,1,92,1,48,9,40,70,40,70,27,9,27,1,19,1,9]], @@ -19,8 +19,8 @@ var numerals = { 9:[[9,1,82,1,90,9,90,92,82,100,9,100,1,92,1,82,9,74,69,74,69,61,9,61,1,53,1,9],[22,27,69,27,69,41,22,41]], }; var _12hour = (require("Storage").readJSON("setting.json",1)||{})["12hour"]||false; -var _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"]; -var _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"]; +var _hCol = []; +var _mCol = []; var _rCol = 0; var scale = g.getWidth()/240; var interval = 0; @@ -42,15 +42,23 @@ var drawFuncs = { }, thickframe : function(poly,isHole){ g.drawPoly(poly,true); - g.drawPoly(translate(1,0,poly),true); - g.drawPoly(translate(1,1,poly),true); - g.drawPoly(translate(0,1,poly),true); + g.drawPoly(translate(1,0,poly,1),true); + g.drawPoly(translate(1,1,poly,1),true); + g.drawPoly(translate(0,1,poly,1),true); + }, + thickfill : function(poly,isHole){ + if (isHole) g.setColor(g.theme.bg); + g.fillPoly(poly,true); + g.setColor(g.theme.fg); + g.drawPoly(translate(1,0,poly,1),true); + g.drawPoly(translate(1,1,poly,1),true); + g.drawPoly(translate(0,1,poly,1),true); } }; -function translate(tx, ty, p){ +function translate(tx, ty, p, ascale){ //return p.map((x, i)=> x+((i&1)?ty:tx)); - return g.transformVertices(p, {x:tx,y:ty,scale:scale}); + return g.transformVertices(p, {x:tx,y:ty,scale:ascale==undefined?scale:ascale}); } @@ -99,6 +107,18 @@ function setUpdateInt(set){ if (set) interval=setInterval(draw, REFRESH_RATE); } +function setUp(){ + if (process.env.HWVERSION==1){ + _hCol = ["#ff5555","#ffff00","#FF9901","#2F00FF"]; + _mCol = ["#55ff55","#ffffff","#00EFEF","#FFBF00"]; + } else { + _hCol = ["#ff0000","#00ff00","#ff0000","#ff00ff"]; + _mCol = ["#00ff00","#0000ff","#00ffff","#00ff00"]; + } + if (settings.color==0) _rCol = Math.floor(Math.random()*_hCol.length); +} + +setUp(); g.clear(1); // Show launcher when button pressed Bangle.setUI("clock"); @@ -111,11 +131,12 @@ if (settings.showDate) { } Bangle.on('lcdPower', function(on){ if (on){ - if (settings.color==0) _rCol = Math.floor(Math.random()*_hCol.length); + setUp(); draw(); setUpdateInt(1); } else setUpdateInt(0); }); +Bangle.on('lock', () => setUp()); Bangle.loadWidgets(); -Bangle.drawWidgets(); +Bangle.drawWidgets(); \ No newline at end of file diff --git a/apps/numerals/numerals.settings.js b/apps/numerals/numerals.settings.js index 70f6e0d98..ae321322a 100644 --- a/apps/numerals/numerals.settings.js +++ b/apps/numerals/numerals.settings.js @@ -12,8 +12,8 @@ } let numeralsSettings = storage.readJSON('numerals.json',1); if (!numeralsSettings) resetSettings(); - let dm = ["fill","frame","framefill","thickframe"]; - let col = ["rnd","r/g","y/w","o/c","b/y"]; + let dm = ["fill","frame","framefill","thickframe","thickfill"]; + let col = process.env.HWVERSION==1?["rnd","r/g","y/w","o/c","b/y"]:["rnd","r/g","g/b","r/c","m/g"]; let btn = [[24,"BTN1"],[22,"BTN2"],[23,"BTN3"],[11,"BTN4"],[16,"BTN5"]]; var menu={ "" : { "title":"Numerals"}, From 11cfd93c9cbbad697c59b636264129855e3f2fec Mon Sep 17 00:00:00 2001 From: ps-igel <60899838+ps-igel@users.noreply.github.com> Date: Wed, 8 Dec 2021 23:19:12 +0100 Subject: [PATCH 61/94] enhance for use with Bangle2, add new draw mode --- apps.json | 1 + 1 file changed, 1 insertion(+) diff --git a/apps.json b/apps.json index ef4ec7db6..c9f04fb4d 100644 --- a/apps.json +++ b/apps.json @@ -2086,6 +2086,7 @@ "id": "numerals", "name": "Numerals Clock", "shortName": "Numerals Clock", + "version": "0.10", "description": "A simple big numerals clock", "icon": "numerals.png", "type": "clock", From 602be413864abc7ce6729eac234c7a9e1c0d4d07 Mon Sep 17 00:00:00 2001 From: Ray Holder Date: Thu, 9 Dec 2021 00:51:36 -0600 Subject: [PATCH 62/94] Fix typo for Thursday image --- apps/93dub/app.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps/93dub/app.js b/apps/93dub/app.js index 8f662a616..1b0f69a94 100644 --- a/apps/93dub/app.js +++ b/apps/93dub/app.js @@ -93,7 +93,7 @@ function draw(){ if (w == 1) {imgW = imgMon;} if (w == 2) {imgW = imgTue;} if (w == 3) {imgW = imgWed;} - if (w == 4) {imgW = imgThr;} + if (w == 4) {imgW = imgThu;} if (w == 5) {imgW = imgFri;} if (w == 6) {imgW = imgSat;} g.drawImage(imgW, 85, 63); From b3234a8e5cabf5316e870410f2250fa986fdcf74 Mon Sep 17 00:00:00 2001 From: Ray Holder Date: Thu, 9 Dec 2021 00:53:01 -0600 Subject: [PATCH 63/94] Update Changelog for 0.05 --- apps/93dub/ChangeLog | 1 + 1 file changed, 1 insertion(+) diff --git a/apps/93dub/ChangeLog b/apps/93dub/ChangeLog index 36859c060..c1b2588bb 100644 --- a/apps/93dub/ChangeLog +++ b/apps/93dub/ChangeLog @@ -2,3 +2,4 @@ 0.02: DiscoMinotaur's adjustments (removed battery and adjusted spacing) 0.03: Code style cleanup 0.04: Set 00:00 to 12:00 for 12 hour time +0.05: Display time, even on Thursday From 3de4a9145437186befb4aecbdb02c11478cfb3f4 Mon Sep 17 00:00:00 2001 From: Ray Holder Date: Thu, 9 Dec 2021 00:53:41 -0600 Subject: [PATCH 64/94] Update README.md to fix markdown rendering --- apps/93dub/README.md | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/apps/93dub/README.md b/apps/93dub/README.md index 3830ee023..4d1ade582 100644 --- a/apps/93dub/README.md +++ b/apps/93dub/README.md @@ -5,8 +5,8 @@ Uses many portions from Espruino documentation, example watchfaces, and the waveclk app. It also sourced from Jon Barlow's 91 Dub v2.0 source code and resources and adapted for Bangle.js 2's screen. Time, date and the battery display works. It is not pixel perfect to the original. Contributors: -Leer10 -Orviwan (original watchface and assets) -Gordon Williams (Bangle.js, watchapps for reference code and documentation) -DiscoMinotaur (adjustments) -Ray Holder (minor 12 hour time rendering adjustment) +* Leer10 +* Orviwan (original watchface and assets) +* Gordon Williams (Bangle.js, watchapps for reference code and documentation) +* DiscoMinotaur (adjustments) +* Ray Holder (minor 12 hour time rendering adjustment, fix Thursdays) From 907d0a3f76b64ecf71dc08a3bc60abb385c7e049 Mon Sep 17 00:00:00 2001 From: Ray Holder Date: Thu, 9 Dec 2021 00:54:42 -0600 Subject: [PATCH 65/94] Bump 93dub version to 0.05 --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index e5d6dad8a..1d8d4c00a 100644 --- a/apps.json +++ b/apps.json @@ -4575,7 +4575,7 @@ "shortName":"93 Dub", "icon": "93dub.png", "screenshots": [{"url":"screenshot.png"}], - "version":"0.04", + "version":"0.05", "description": "Fan recreation of orviwan's 91 Dub app for the Pebble smartwatch. Uses assets from his 91-Dub-v2.0 repo", "tags": "clock", "type": "clock", From 73574201bfc107aba7fdf19b3d22af2b3cf97eeb Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 9 Dec 2021 09:13:11 +0000 Subject: [PATCH 66/94] gpsrec 0.27: Map drawing with light theme (fix #1023) --- apps.json | 6 +++--- apps/gpsrec/ChangeLog | 1 + apps/gpsrec/app.js | 11 +++++------ 3 files changed, 9 insertions(+), 9 deletions(-) diff --git a/apps.json b/apps.json index 9e3d862e8..c47d3cf6b 100644 --- a/apps.json +++ b/apps.json @@ -727,7 +727,7 @@ { "id": "gpsrec", "name": "GPS Recorder", - "version": "0.26", + "version": "0.27", "description": "Application that allows you to record a GPS track. Can run in background", "icon": "app.png", "tags": "tool,outdoors,gps,widget", @@ -4791,7 +4791,7 @@ "icon": "app.png", "allow_emulator": true, "tags": "tools, keyboard, text, scribble", - "supports" : ["BANGLEJS2"], + "supports" : ["BANGLEJS2"], "readme": "README.md", "storage": [ {"name":"scribble.app.js","url":"app.js"}, @@ -4801,5 +4801,5 @@ { "url":"screenshot.png" } ] } - + ] diff --git a/apps/gpsrec/ChangeLog b/apps/gpsrec/ChangeLog index cb22dd13f..365405846 100644 --- a/apps/gpsrec/ChangeLog +++ b/apps/gpsrec/ChangeLog @@ -28,3 +28,4 @@ 0.24: Better support for Bangle.js 2, avoid widget area for Graphs, smooth graphs more 0.25: Fix issue where if Bangle.js 2 got a GPS fix but no reported time, errors could be caused by the widget (fix #935) 0.26: Multiple bugfixes +0.27: Map drawing with light theme (fix #1023) diff --git a/apps/gpsrec/app.js b/apps/gpsrec/app.js index df3353930..833a816ea 100644 --- a/apps/gpsrec/app.js +++ b/apps/gpsrec/app.js @@ -197,15 +197,14 @@ function plotTrack(info) { g.setColor(1,0.5,0.5); g.setFont("Vector",16); g.drawString("Track"+info.fn.toString()+" - Loading",10,220); - g.setColor(0,0,0); + g.setColor(g.theme.bg); g.fillRect(0,220,239,239); if (!info.qOSTM) { g.setColor(1, 0, 0); g.fillRect(9,80,11,120); g.fillPoly([9,60,19,80,0,80]); - g.setColor(1,1,1); + g.setColor(g.theme.fg); g.drawString("N",2,40); - g.setColor(1,1,1); } else { osm.lat = info.lat; osm.lon = info.lon; @@ -228,7 +227,7 @@ function plotTrack(info) { g.setColor(0,1,0); g.fillCircle(mp.x,mp.y,5); if (info.qOSTM) g.setColor(1,0,0.55); - else g.setColor(1,1,1); + else g.setColor(g.theme.fg); l = f.readLine(f); while(l!==undefined) { c = l.split(","); @@ -248,11 +247,11 @@ function plotTrack(info) { g.setColor(1,0,0); g.fillCircle(ox,oy,5); if (info.qOSTM) g.setColor(0, 0, 0); - else g.setColor(1,1,1); + else g.setColor(g.theme.fg); g.drawString(require("locale").distance(dist),g.getWidth() / 2, g.getHeight() - 20); g.setFont("6x8",2); g.setFontAlign(0,0,3); - g.drawString("Back",g.getWidth() - 10, g.getHeight() - 40); + g.drawString("Back",g.getWidth() - 10, g.getHeight()/2); setWatch(function() { viewTrack(info.fn, info); }, global.BTN3||BTN1); From 68cef85b6be4e594fe7b8c72fd242bd42f3b21c0 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 12:51:03 +0100 Subject: [PATCH 67/94] Poweroff app -> tool and emulator --- apps.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 8cbc755d0..173439c8b 100644 --- a/apps.json +++ b/apps.json @@ -4593,9 +4593,10 @@ "version":"0.01", "description": "Simple app to power off your Bangle.js", "icon": "app.png", - "tags": "poweroff, shutdown", + "tags": "tool, poweroff, shutdown", "supports" : ["BANGLEJS", "BANGLEJS2"], "readme": "README.md", + "allow_emulator": true, "storage": [ {"name":"poweroff.app.js","url":"app.js"}, {"name":"poweroff.img","url":"app-icon.js","evaluate":true} From b98a0d262cdc0babbb36bbeaacf5f67586c25c54 Mon Sep 17 00:00:00 2001 From: crazysaem Date: Thu, 9 Dec 2021 12:02:16 +0000 Subject: [PATCH 68/94] ptlaunch: Turn on lcd when launching an app if the lock screen was disabled in the settings --- apps.json | 2 +- apps/ptlaunch/ChangeLog | 3 ++- apps/ptlaunch/boot.js | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 89b46e301..aacac021d 100644 --- a/apps.json +++ b/apps.json @@ -4805,7 +4805,7 @@ "id": "ptlaunch", "name": "Pattern Launcher", "shortName": "Pattern Launcher", - "version": "0.01", + "version": "0.02", "description": "Directly launch apps from the clock screen with custom patterns.", "icon": "app.png", "tags": "tools", diff --git a/apps/ptlaunch/ChangeLog b/apps/ptlaunch/ChangeLog index 4967d3207..f50936885 100644 --- a/apps/ptlaunch/ChangeLog +++ b/apps/ptlaunch/ChangeLog @@ -1 +1,2 @@ -0.01: Initial creation of the pattern launch app \ No newline at end of file +0.01: Initial creation of the pattern launch app +0.02: Turn on lcd when launching an app if the lock screen was disabled in the settings diff --git a/apps/ptlaunch/boot.js b/apps/ptlaunch/boot.js index 1433f1700..14d390b13 100644 --- a/apps/ptlaunch/boot.js +++ b/apps/ptlaunch/boot.js @@ -135,6 +135,12 @@ var dragHandler = (position) => { if (storedPatterns[pattern]) { var app = storedPatterns[pattern].app; if (!!app && !!app.src) { + if (storedPatterns.settings) { + if (storedPatterns.settings.lockDisabled) { + Bangle.setLCDPower(true); + } + } + Bangle.removeListener("drag", dragHandler); load(app.src); } From 7df753a0f75df09f24a05b781e41334b59b336be Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 13:29:17 +0100 Subject: [PATCH 69/94] New clock: CLI complete --- apps/clicompleteclk/app.js | 183 +++++++++++++++++++++++++++++++++++++ 1 file changed, 183 insertions(+) create mode 100644 apps/clicompleteclk/app.js diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js new file mode 100644 index 000000000..487dbfa07 --- /dev/null +++ b/apps/clicompleteclk/app.js @@ -0,0 +1,183 @@ +const storage = require('Storage'); +const locale = require("locale"); + +const font = "12x20"; +const fontsize = 1; +const fontheight = 19; + +const marginTop = 10; +const marginLeftTopic = 3; // margin of topics +const marginLeftData = 68; // margin of data values + +const topicColor = g.theme.dark ? "#fff" : "#000"; +const textColor = g.theme.dark ? "#0f0" : "#080"; + +let hrtValue; +let localTempValue; +let weatherTempString; +let lastHeartRateRowIndex; + +// timeout used to update every minute +var drawTimeout; +// schedule a draw for the next minute +function queueDraw() { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = setTimeout(function() { + drawTimeout = undefined; + drawAll(false); + }, 60000 - (Date.now() % 60000)); +} + +function drawAll(drawInfoToo){ + let now = new Date(); + updateTime(now); + if (drawInfoToo) { + drawInfo(now); + } + queueDraw(); +} + +function updateTime(now){ + if (!Bangle.isLCDOn()) return; + writeLineTopic("TIME", 1); + writeLine(locale.time(now,1),1); + if(now.getMinutes() == 0) + drawInfo(now); +} + +function drawInfo(now) { + if (now == undefined) + now = new Date(); + + let i = 2; + + writeLineTopic("DOWK", i); + writeLine(locale.dow(now),i); + i++; + + writeLineTopic("DATE", i); + writeLine(locale.date(now,1),i); + i++; + + /* + writeLineTopic("BAT", i); + const b = E.getBattery(); + writeLine(b + "%", i); // TODO make bars + i++; + */ + + // weather + var weatherJson = getWeather(); + if(weatherJson && weatherJson.weather){ + const currentWeather = weatherJson.weather; + + const weatherTempValue = locale.temp(currentWeather.temp-273.15); + weatherTempString = weatherTempValue; + writeLineTopic("WTHR", i); + writeLine(currentWeather.txt,i); + i++; + } + + // temperatures (local & weather) + if (localTempValue != undefined || weatherTempString != undefined) { + writeLineTopic("TEMP", i); + let tempString = ""; + if (localTempValue != undefined) + tempString += "l: " + localTempValue; + if (tempString != "") + tempString += ", "; + if (weatherTempString != undefined) + tempString += weatherTempString; + writeLine(tempString,i); + i++; + } + + // steps + if (stepsWidget() != undefined) { + writeLineTopic("STEP", i); + const steps = stepsWidget().getSteps(); + writeLine(steps, i); + i++; + } + + drawHeartRate(i); +} + +function drawHeartRate(i) { + if (hrtValue != undefined) { + writeLineTopic("HRTM", i); + writeLine(hrtValue,i); + } + lastHeartRateRowIndex = i; +} + + +function writeLineTopic(str, line) { + var y = marginTop+line*fontheight; + g.setFont(font,fontsize); + g.setColor(topicColor).setFontAlign(-1,-1); + + g.clearRect(0,y,g.getWidth(),y+fontheight-1); + g.drawString("[" + str + "]",marginLeftTopic,y); +} + +function writeLine(str,line){ + var y = marginTop+line*fontheight; + g.setFont(font,fontsize); + g.setColor(textColor).setFontAlign(-1,-1); + g.drawString(str,marginLeftData,y); +} + + +Bangle.on('HRM', function(hrm) { + //if(hrm.confidence > 90){ + hrtValue = hrm.bpm + " bpm"; + if (Bangle.isLCDOn()) + drawHeartRate(lastHeartRateRowIndex); + //} else { + // hrtValue = undefined; + //} +}); + + +function getTemperature() { + if (Bangle.getPressure) { + Bangle.getPressure().then(onTemperature); + } else { + onTemperature({ + temperature : E.getTemperature() + }); + } +} +function onTemperature(p) { + localTempValue = locale.temp(p.temperature.toFixed(1)); +} + +function stepsWidget() { + if (WIDGETS.activepedom !== undefined) { + return WIDGETS.activepedom; + } else if (WIDGETS.wpedom !== undefined) { + return WIDGETS.wpedom; + } + return undefined; +} + + +function getWeather() { + let jsonWeather = storage.readJSON('weather.json'); + return jsonWeather; +} + +g.clear(); +Bangle.setUI("clock"); +Bangle.loadWidgets(); +Bangle.drawWidgets(); +drawAll(true); +Bangle.on('lcdPower',function(on) { + if (on) { + drawAll(true); + } else { + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); From a1599a967b0cf5223c0e96c041e14c98b6212ff7 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 13:29:54 +0100 Subject: [PATCH 70/94] Adding icons, readme and changelog --- apps/clicompleteclk/ChangeLog | 1 + apps/clicompleteclk/README.md | 18 ++++++++++++++++++ apps/clicompleteclk/app-icon.js | 1 + apps/clicompleteclk/app.png | Bin 0 -> 258 bytes 4 files changed, 20 insertions(+) create mode 100644 apps/clicompleteclk/ChangeLog create mode 100644 apps/clicompleteclk/README.md create mode 100644 apps/clicompleteclk/app-icon.js create mode 100644 apps/clicompleteclk/app.png diff --git a/apps/clicompleteclk/ChangeLog b/apps/clicompleteclk/ChangeLog new file mode 100644 index 000000000..85b5360ad --- /dev/null +++ b/apps/clicompleteclk/ChangeLog @@ -0,0 +1 @@ +0.01: New clock! diff --git a/apps/clicompleteclk/README.md b/apps/clicompleteclk/README.md new file mode 100644 index 000000000..653123187 --- /dev/null +++ b/apps/clicompleteclk/README.md @@ -0,0 +1,18 @@ +# Command line complete clock + +Command line styled clock with lots of information: + +It can show the following (depending on availability) information: +* Time +* Day of week +* Date +* Weather condition (requires weather app) +* Temperature (requires weather app) +* Steps (requires a step widget) +* Heart rate + +## Creator +Marco ([myxor](https://github.com/myxor)) + +## Icon +Icon taken from [materialdesignicons](https://materialdesignicons.com) under Apache License 2.0 diff --git a/apps/clicompleteclk/app-icon.js b/apps/clicompleteclk/app-icon.js new file mode 100644 index 000000000..b874bb6fa --- /dev/null +++ b/apps/clicompleteclk/app-icon.js @@ -0,0 +1 @@ +require("heatshrink").decompress(atob("mEwgI/8/4ACAqYv/F/PwAqgA6A==")) diff --git a/apps/clicompleteclk/app.png b/apps/clicompleteclk/app.png new file mode 100644 index 0000000000000000000000000000000000000000..104e6124afa8fcb86f8f8c625912eb4f933ca51a GIT binary patch literal 258 zcmeAS@N?(olHy`uVBq!ia0vp^1|ZDA1|-9oezpTC&H|6fVg?3oArNM~bhqvgP;iT< zi(^Oz>)RO@xf&FBTsQB3zkKr|^Te1V)3#eU@t2n79Y5=M`cMM{ivj~9$DbJo%8qUG zuhWx16zKF+>|508S;{^=CznpCii%LyUMQej@Y|0ePyN!b*XFKsLhv}Q9i~I>c#?<+C3pmbRd)r-MrtmGC#VF{-rk^(|_VTaz zZ?kt|VedDg>Z*Uw{T&!L>L-aZSb?43aA4K}#>F$3-mEKrrVn&KgQu&X%Q~loCIB;9 BV`cyV literal 0 HcmV?d00001 From 93361297bd23d90dde7538a64a32f456cdd4614a Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 13:31:12 +0100 Subject: [PATCH 71/94] Add clicompleteclk to apps.json --- apps.json | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/apps.json b/apps.json index 8cbc755d0..f9d417b95 100644 --- a/apps.json +++ b/apps.json @@ -4825,5 +4825,20 @@ { "name": "ptlaunch.img", "url": "app-icon.js", "evaluate": true } ], "data": [{"name":"ptlaunch.patterns.json"}] - } + }, + { "id": "clicompleteclk", + "name": "Command line complete clock", + "shortName":"Command line complete clock", + "version":"0.01", + "description": "Command line styled clock with lots of information", + "icon": "app.png", + "type": "clock", + "tags": "clock,cli,command,bash,shell,weather,hrt", + "supports" : ["BANGLEJS", "BANGLEJS2"], + "readme": "README.md", + "storage": [ + {"name":"clicompleteclk.app.js","url":"app.js"}, + {"name":"clicompleteclk.img","url":"app-icon.js","evaluate":true} + ] +} ] From 32107c668eda2e644560dd158a7b8e30a0db3f4a Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 13:34:33 +0100 Subject: [PATCH 72/94] Make shortName short --- apps.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/apps.json b/apps.json index f9d417b95..231e40949 100644 --- a/apps.json +++ b/apps.json @@ -4828,7 +4828,7 @@ }, { "id": "clicompleteclk", "name": "Command line complete clock", - "shortName":"Command line complete clock", + "shortName":"Cli cmplt clk", "version":"0.01", "description": "Command line styled clock with lots of information", "icon": "app.png", From e5da5b8040963d060dfc88d22e39cfad04687e4b Mon Sep 17 00:00:00 2001 From: Jade Edward Date: Thu, 9 Dec 2021 23:34:52 +1100 Subject: [PATCH 73/94] Copy from widmp, flip phases --- apps.json | 13 +++++++++++++ apps/widmpsh/ChangeLog | 1 + apps/widmpsh/widget.js | 25 +++++++++++++++++++++++++ apps/widmpsh/widget.png | Bin 0 -> 2390 bytes 4 files changed, 39 insertions(+) create mode 100644 apps/widmpsh/ChangeLog create mode 100644 apps/widmpsh/widget.js create mode 100644 apps/widmpsh/widget.png diff --git a/apps.json b/apps.json index 8cbc755d0..32e944b44 100644 --- a/apps.json +++ b/apps.json @@ -1937,6 +1937,19 @@ {"name":"widmp.wid.js","url":"widget.js"} ] }, + { + "id": "widmpsh", + "name": "Moon Phase Widget Southern Hemisphere", + "version": "0.01", + "description": "Display the current moon phase in blueish for the southern hemisphere in eight phases", + "icon": "widget.png", + "type": "widget", + "tags": "widget,tools", + "supports": ["BANGLEJS","BANGLEJS2"], + "storage": [ + {"name":"widmpsh.wid.js","url":"widget.js"} + ] + }, { "id": "minionclk", "name": "Minion clock", diff --git a/apps/widmpsh/ChangeLog b/apps/widmpsh/ChangeLog new file mode 100644 index 000000000..e432f82e5 --- /dev/null +++ b/apps/widmpsh/ChangeLog @@ -0,0 +1 @@ +0.01: Copied from widmp and flipped the phase directions! diff --git a/apps/widmpsh/widget.js b/apps/widmpsh/widget.js new file mode 100644 index 000000000..9115a4719 --- /dev/null +++ b/apps/widmpsh/widget.js @@ -0,0 +1,25 @@ +WIDGETS["widmoonsh"] = { area: "tr", width: 24, draw: function() { + const MC = 29.5305882, NM = 694039.09; + var r = 11, mx = this.x + 12; my = this.y + 12; + + function moonPhase(d) { + var tmp, month = d.getMonth(), year = d.getFullYear(), day = d.getDate(); + if (month < 3) {year--; month += 12;} + tmp = ((365.25 * year + 30.6 * ++month + day - NM) / MC); + return Math.round(((tmp - (tmp | 0)) * 7)+1); + } + + const BLACK = g.theme.bg, MOON = 0x41f; + var moon = { + 0: () => { g.reset().setColor(BLACK).fillRect(mx - r, my - r, mx + r, my + r);}, + 1: () => { moon[0](); g.setColor(MOON).drawCircle(mx, my, r);}, + 2: () => { moon[3](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);}, + 3: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx, my - r, mx + r, my + r);}, + 4: () => { moon[3](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);}, + 5: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r);}, + 6: () => { moon[7](); g.setColor(MOON).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);}, + 7: () => { moon[0](); g.setColor(MOON).fillCircle(mx, my, r).setColor(BLACK).fillRect(mx - r, my - r, mx, my + r);}, + 8: () => { moon[7](); g.setColor(BLACK).fillEllipse(mx - r / 2, my - r, mx + r / 2, my + r);} + }; + moon[moonPhase(Date())](); +} }; diff --git a/apps/widmpsh/widget.png b/apps/widmpsh/widget.png new file mode 100644 index 0000000000000000000000000000000000000000..aeaadea4bcfce546885d44d7f63c4495cf2e6a85 GIT binary patch literal 2390 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 P^xJ{8b+D Date: Thu, 9 Dec 2021 13:38:10 +0100 Subject: [PATCH 74/94] Make names even shorter + allow emulator --- apps.json | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 231e40949..340fb6f13 100644 --- a/apps.json +++ b/apps.json @@ -4827,11 +4827,12 @@ "data": [{"name":"ptlaunch.patterns.json"}] }, { "id": "clicompleteclk", - "name": "Command line complete clock", - "shortName":"Cli cmplt clk", + "name": "CLI cmplt clock", + "shortName":"CLI cmplt clk", "version":"0.01", "description": "Command line styled clock with lots of information", "icon": "app.png", + "allow_emulator": true, "type": "clock", "tags": "clock,cli,command,bash,shell,weather,hrt", "supports" : ["BANGLEJS", "BANGLEJS2"], From 7ce4ada3dff0e844cc1386ca9bb5a64a20ddf834 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 13:40:33 +0100 Subject: [PATCH 75/94] Fix names (again) --- apps.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/apps.json b/apps.json index 340fb6f13..cb920f43d 100644 --- a/apps.json +++ b/apps.json @@ -4827,8 +4827,8 @@ "data": [{"name":"ptlaunch.patterns.json"}] }, { "id": "clicompleteclk", - "name": "CLI cmplt clock", - "shortName":"CLI cmplt clk", + "name": "CLI complete clock", + "shortName":"CLI cmplt clock", "version":"0.01", "description": "Command line styled clock with lots of information", "icon": "app.png", From 7b09fd9b4f7b9c998df6a4b644ce6d0b4dfb63b8 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 14:53:22 +0100 Subject: [PATCH 76/94] Add todo to README --- apps/clicompleteclk/README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/clicompleteclk/README.md b/apps/clicompleteclk/README.md index 653123187..e182b55fd 100644 --- a/apps/clicompleteclk/README.md +++ b/apps/clicompleteclk/README.md @@ -9,7 +9,12 @@ It can show the following (depending on availability) information: * Weather condition (requires weather app) * Temperature (requires weather app) * Steps (requires a step widget) -* Heart rate +* Heart rate (when screen is on and unlocked) + +## TODO +* Make time font bigger +* Show progress of steps (if any goal is set) +* Show trend of HRM out of history data ## Creator Marco ([myxor](https://github.com/myxor)) From 5903aed3e437f8a5bbc76bff49d12720ffe19940 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 14:53:51 +0100 Subject: [PATCH 77/94] Turn on HRM when screen is on and unlocked --- apps/clicompleteclk/app.js | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js index 487dbfa07..cc7fd5e41 100644 --- a/apps/clicompleteclk/app.js +++ b/apps/clicompleteclk/app.js @@ -104,9 +104,11 @@ function drawInfo(now) { } function drawHeartRate(i) { + writeLineTopic("HRTM", i); if (hrtValue != undefined) { - writeLineTopic("HRTM", i); writeLine(hrtValue,i); + } else { + writeLine("-",i); } lastHeartRateRowIndex = i; } @@ -129,6 +131,15 @@ function writeLine(str,line){ } +// turn on HRM when the LCD is unlocked +Bangle.on('lock', function(isLocked) { + if (!isLocked) { + Bangle.setHRMPower(1,"clicompleteclk"); + hrtValue = undefined; + } else { + Bangle.setHRMPower(0,"clicompleteclk"); + } +}); Bangle.on('HRM', function(hrm) { //if(hrm.confidence > 90){ hrtValue = hrm.bpm + " bpm"; @@ -173,6 +184,7 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); Bangle.drawWidgets(); drawAll(true); + Bangle.on('lcdPower',function(on) { if (on) { drawAll(true); From 0a67d177bbf44f8ff2e8fc9a65e63222930eacb3 Mon Sep 17 00:00:00 2001 From: Marco H Date: Thu, 9 Dec 2021 15:35:17 +0100 Subject: [PATCH 78/94] Update app.js * Remove local temperature * Draw heart rate value in grey if the value is not up to date --- apps/clicompleteclk/app.js | 75 +++++++++++++++++--------------------- 1 file changed, 34 insertions(+), 41 deletions(-) diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js index cc7fd5e41..89dbce919 100644 --- a/apps/clicompleteclk/app.js +++ b/apps/clicompleteclk/app.js @@ -13,6 +13,7 @@ const topicColor = g.theme.dark ? "#fff" : "#000"; const textColor = g.theme.dark ? "#0f0" : "#080"; let hrtValue; +let hrtValueIsOld = false; let localTempValue; let weatherTempString; let lastHeartRateRowIndex; @@ -76,19 +77,9 @@ function drawInfo(now) { writeLineTopic("WTHR", i); writeLine(currentWeather.txt,i); i++; - } - // temperatures (local & weather) - if (localTempValue != undefined || weatherTempString != undefined) { writeLineTopic("TEMP", i); - let tempString = ""; - if (localTempValue != undefined) - tempString += "l: " + localTempValue; - if (tempString != "") - tempString += ", "; - if (weatherTempString != undefined) - tempString += weatherTempString; - writeLine(tempString,i); + writeLine(weatherTempValue,i); i++; } @@ -104,11 +95,16 @@ function drawInfo(now) { } function drawHeartRate(i) { + if (i == undefined) + i = lastHeartRateRowIndex; writeLineTopic("HRTM", i); if (hrtValue != undefined) { - writeLine(hrtValue,i); + if (!hrtValueIsOld) + writeLine(hrtValue,i); + else + writeLine(hrtValue,i, topicColor); } else { - writeLine("-",i); + writeLine("...",i); } lastHeartRateRowIndex = i; } @@ -123,47 +119,54 @@ function writeLineTopic(str, line) { g.drawString("[" + str + "]",marginLeftTopic,y); } -function writeLine(str,line){ +function writeLine(str,line,pColor){ + if (pColor == undefined) + pColor = textColor; var y = marginTop+line*fontheight; g.setFont(font,fontsize); - g.setColor(textColor).setFontAlign(-1,-1); + g.setColor(pColor).setFontAlign(-1,-1); g.drawString(str,marginLeftData,y); } +// EVENTS: // turn on HRM when the LCD is unlocked Bangle.on('lock', function(isLocked) { if (!isLocked) { Bangle.setHRMPower(1,"clicompleteclk"); - hrtValue = undefined; + if (hrtValue == undefined) + hrtValue = "..."; + else + hrtValueIsOld = true; + drawHeartRate(); } else { + hrtValueIsOld = true; Bangle.setHRMPower(0,"clicompleteclk"); } }); + +Bangle.on('lcdPower',function(on) { + if (on) { + drawAll(true); + } else { + hrtValueIsOld = true; + if (drawTimeout) clearTimeout(drawTimeout); + drawTimeout = undefined; + } +}); + Bangle.on('HRM', function(hrm) { //if(hrm.confidence > 90){ - hrtValue = hrm.bpm + " bpm"; + hrtValueIsOld = false; + hrtValue = hrm.bpm; if (Bangle.isLCDOn()) - drawHeartRate(lastHeartRateRowIndex); + drawHeartRate(); //} else { // hrtValue = undefined; //} }); -function getTemperature() { - if (Bangle.getPressure) { - Bangle.getPressure().then(onTemperature); - } else { - onTemperature({ - temperature : E.getTemperature() - }); - } -} -function onTemperature(p) { - localTempValue = locale.temp(p.temperature.toFixed(1)); -} - function stepsWidget() { if (WIDGETS.activepedom !== undefined) { return WIDGETS.activepedom; @@ -173,7 +176,6 @@ function stepsWidget() { return undefined; } - function getWeather() { let jsonWeather = storage.readJSON('weather.json'); return jsonWeather; @@ -184,12 +186,3 @@ Bangle.setUI("clock"); Bangle.loadWidgets(); Bangle.drawWidgets(); drawAll(true); - -Bangle.on('lcdPower',function(on) { - if (on) { - drawAll(true); - } else { - if (drawTimeout) clearTimeout(drawTimeout); - drawTimeout = undefined; - } -}); From 978de345ee55a4f908930f4140b3b5d1e3a58a20 Mon Sep 17 00:00:00 2001 From: Gordon Williams Date: Thu, 9 Dec 2021 14:56:36 +0000 Subject: [PATCH 79/94] fwupdate 0.02: Add support for ZIPs Find and download ZIPs direct from the Espruino website Take 'beta' tag off --- apps.json | 4 +- apps/fwupdate/ChangeLog | 3 + apps/fwupdate/custom.html | 151 ++++++++++++++++++++++++++++---------- 3 files changed, 117 insertions(+), 41 deletions(-) diff --git a/apps.json b/apps.json index c47d3cf6b..6deee8fa4 100644 --- a/apps.json +++ b/apps.json @@ -1,8 +1,8 @@ [ { "id": "fwupdate", - "name": "Firmware Update (BETA)", - "version": "0.01", + "name": "Firmware Update", + "version": "0.02", "description": "Uploads new Espruino firmwares to Bangle.js 2", "icon": "app.png", "type": "RAM", diff --git a/apps/fwupdate/ChangeLog b/apps/fwupdate/ChangeLog index ec66c5568..96e7e4e9b 100644 --- a/apps/fwupdate/ChangeLog +++ b/apps/fwupdate/ChangeLog @@ -1 +1,4 @@ 0.01: Initial version +0.02: Add support for ZIPs + Find and download ZIPs direct from the Espruino website + Take 'beta' tag off diff --git a/apps/fwupdate/custom.html b/apps/fwupdate/custom.html index 7230a77a8..4ee99479b 100644 --- a/apps/fwupdate/custom.html +++ b/apps/fwupdate/custom.html @@ -3,29 +3,44 @@ -

THIS IS CURRENTLY BETA - PLEASE USE THE NORMAL FIRMWARE UPDATE - INSTRUCTIONS FOR BANGLE.JS 1 AND BANGLE.JS 2

-

Firmware updates using the App Loader are only possible on +

Firmware updates using the App Loader are only possible on Bangle.js 2. For firmware updates on Bangle.js 1 please - see the Bangle.js 1 instructions

+ see the Bangle.js 1 instructions

+

Your current firmware version is unknown

+

Firmware updates via this tool work differently to the NRF Connect method mentioned on + the Bangle.js page. Firmware + is uploaded to a file on the Bangle. Once complete the Bangle reboots and the bootloader copies + the new firmware into internal Storage.

+

 
     
+    
+    
 
     
   

From 61553056da20cd3e1f126d732cb9043bbb126b8b Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 15:56:37 +0000
Subject: [PATCH 80/94] app notes

---
 apps.json | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/apps.json b/apps.json
index 6deee8fa4..5abbfb1f8 100644
--- a/apps.json
+++ b/apps.json
@@ -79,7 +79,7 @@
     "name": "Android Integration",
     "shortName": "Android",
     "version": "0.04",
-    "description": "(BETA) App to display notifications from Gadgetbridge on Android. This will eventually replace the Gadgetbridge widget.",
+    "description": "Display notifications/music/etc from Gadgetbridge on Android. This replaces the old Gadgetbridge widget.",
     "icon": "app.png",
     "tags": "tool,system,messages,notifications",
     "dependencies": {"messages":"app"},
@@ -96,7 +96,7 @@
     "id": "ios",
     "name": "iOS Integration",
     "version": "0.06",
-    "description": "(BETA) App to display notifications from iOS devices",
+    "description": "Display notifications/music/etc from iOS devices",
     "icon": "app.png",
     "tags": "tool,system,ios,apple,messages,notifications",
     "dependencies": {"messages":"app"},
@@ -283,7 +283,7 @@
     "id": "gbridge",
     "name": "Gadgetbridge",
     "version": "0.24",
-    "description": "The default notification handler for Gadgetbridge notifications from Android. This will eventually be replaced by the 'Android' app.",
+    "description": "(NOT RECOMMENDED) Handles Gadgetbridge notifications from Android. This is now replaced by the 'Android' app.",
     "icon": "app.png",
     "type": "widget",
     "tags": "tool,system,android,widget",

From 52ed2c3b5d5bf447f6a21c252acf65ac5acb143e Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 15:56:58 +0000
Subject: [PATCH 81/94] 0.04: Fix widget hiding code (fix #1046)

---
 apps.json                 |  6 +++---
 apps/pebble/ChangeLog     |  1 +
 apps/pebble/pebble.app.js | 11 ++++++-----
 apps/widviz/ChangeLog     |  6 +++---
 apps/widviz/widget.js     | 11 ++++++++---
 5 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/apps.json b/apps.json
index 5abbfb1f8..484ea6f7e 100644
--- a/apps.json
+++ b/apps.json
@@ -2642,12 +2642,12 @@
     "id": "widviz",
     "name": "Widget Visibility Widget",
     "shortName": "Viz Widget",
-    "version": "0.02",
+    "version": "0.03",
     "description": "Swipe left to hide top bar widgets, swipe right to redisplay.",
     "icon": "eye.png",
     "type": "widget",
     "tags": "widget",
-    "supports": ["BANGLEJS"],
+    "supports": ["BANGLEJS","BANGLESJ2"],
     "storage": [
       {"name":"widviz.wid.js","url":"widget.js"}
     ]
@@ -4670,7 +4670,7 @@
     "id": "pebble",
     "name": "Pebble Clock",
     "shortName": "Pebble",
-    "version": "0.03",
+    "version": "0.04",
     "description": "A pebble style clock to keep the rebellion going",
     "readme": "README.md",
     "icon": "pebble.png",
diff --git a/apps/pebble/ChangeLog b/apps/pebble/ChangeLog
index fc3ff3ba4..76f90de8b 100644
--- a/apps/pebble/ChangeLog
+++ b/apps/pebble/ChangeLog
@@ -1,3 +1,4 @@
 0.01: first release
 0.02: included deployment of pebble.settings.js in apps.json
 0.03: Changed time+calendar font to LECO1976Regular, changed to slanting boot
+0.04: Fix widget hiding code (fix #1046)
diff --git a/apps/pebble/pebble.app.js b/apps/pebble/pebble.app.js
index ce9ab3340..106e09b82 100644
--- a/apps/pebble/pebble.app.js
+++ b/apps/pebble/pebble.app.js
@@ -34,7 +34,7 @@ function draw() {
   // turn the warning on once we have dipped below 30%
   if (E.getBattery() < 30)
     batteryWarning = true;
-  
+
   // turn the warning off once we have dipped above 40%
   if (E.getBattery() > 40)
     batteryWarning = false;
@@ -57,7 +57,7 @@ function draw() {
   g.setFontAlign(0, -1);
   g.drawString(da[0].toUpperCase(), w/4, ha); // day of week
   g.drawString(getSteps(), 3*w/4, ha);
-  
+
   // time
   // white on red for battery warning
   g.setColor(!batteryWarning ? g.theme.bg : '#f00');
@@ -71,7 +71,7 @@ function draw() {
   // contrast bar
   g.setColor(g.theme.fg);
   g.fillRect(0, h3, w, h3 + t);
-  
+
   // the bottom
   g.setColor(settings.bg);
   g.fillRect(0, h3 + t, w, h);
@@ -111,9 +111,10 @@ g.clear();
 Bangle.loadWidgets();
 /*
  * we are not drawing the widgets as we are taking over the whole screen
- * so we will blank out the draw() functions of each widget
+ * so we will blank out the draw() functions of each widget and change the
+ * area to the top bar doesn't get cleared.
  */
-for (let wd of WIDGETS) {wd.draw=()=>{};}
+for (let wd of WIDGETS) {wd.draw=()=>{};wd.area="";}
 loadSettings();
 setInterval(draw, 15000); // refresh every 15s
 draw();
diff --git a/apps/widviz/ChangeLog b/apps/widviz/ChangeLog
index e1958b429..9785f4d84 100644
--- a/apps/widviz/ChangeLog
+++ b/apps/widviz/ChangeLog
@@ -1,3 +1,3 @@
- 0.01: New Widget
- 0.02: swipe left,right update
- 
+0.01: New Widget
+0.02: swipe left,right update
+0.03: Fix widget visibility code to the top bar isn't cleared by drawWidgets 
diff --git a/apps/widviz/widget.js b/apps/widviz/widget.js
index 241dabf61..1490cf11a 100644
--- a/apps/widviz/widget.js
+++ b/apps/widviz/widget.js
@@ -6,16 +6,21 @@
     if (!Bangle.isLCDOn() || saved) return;
     saved = [];
     for (var wd of WIDGETS) {
-      saved.push(wd.draw);
+      saved.push({d:wd.draw,a:wd.area});
       wd.draw=()=>{};
+      wd.area="";
     }
     g.setColor(0,0,0);
-    g.fillRect(0,0,239,23);
+    g.fillRect(0,0,g.getWidth(),23);
   }
 
   function reveal(){
     if (!Bangle.isLCDOn() || !saved) return;
-    for (var wd of WIDGETS) wd.draw = saved.shift();
+    for (var wd of WIDGETS) {
+      var o = saved.shift();
+      wd.draw = o.d;
+      wd.area = o.a;
+    }
     Bangle.drawWidgets();
     saved=null;
   }

From f8e04ad28a348787d53e2f7aea1ee558dfab5081 Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 16:16:01 +0000
Subject: [PATCH 82/94] oops

---
 apps.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps.json b/apps.json
index 4ffdfde9c..0e85f6e65 100644
--- a/apps.json
+++ b/apps.json
@@ -2660,7 +2660,7 @@
     "icon": "eye.png",
     "type": "widget",
     "tags": "widget",
-    "supports": ["BANGLEJS","BANGLESJ2"],
+    "supports": ["BANGLEJS","BANGLEJS2"],
     "storage": [
       {"name":"widviz.wid.js","url":"widget.js"}
     ]

From 59b06d5aef7d9da0884161b55c26e285d2f25add Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 16:49:28 +0000
Subject: [PATCH 83/94] boot 0.38: Option to log to file if settings.log==2
 settings 0.36: Added 'Utils' menu with helpful utilities for restoring
 Bangle.js

---
 apps.json                |  4 +--
 apps/boot/ChangeLog      |  1 +
 apps/boot/bootupdate.js  | 15 +++++++--
 apps/setting/ChangeLog   |  1 +
 apps/setting/README.md   | 23 ++++++++++----
 apps/setting/settings.js | 68 ++++++++++++++++++++++++++++++----------
 6 files changed, 84 insertions(+), 28 deletions(-)

diff --git a/apps.json b/apps.json
index 0e85f6e65..50e14dec7 100644
--- a/apps.json
+++ b/apps.json
@@ -16,7 +16,7 @@
   {
     "id": "boot",
     "name": "Bootloader",
-    "version": "0.37",
+    "version": "0.38",
     "description": "This is needed by Bangle.js to automatically load the clock, menu, widgets and settings",
     "icon": "bootloader.png",
     "type": "bootloader",
@@ -146,7 +146,7 @@
   {
     "id": "setting",
     "name": "Settings",
-    "version": "0.35",
+    "version": "0.36",
     "description": "A menu for setting up Bangle.js",
     "icon": "settings.png",
     "tags": "tool,system",
diff --git a/apps/boot/ChangeLog b/apps/boot/ChangeLog
index ffc2be495..b941a9937 100644
--- a/apps/boot/ChangeLog
+++ b/apps/boot/ChangeLog
@@ -41,3 +41,4 @@
       Don't set beep vibration up on Bangle.js 2 (built in)
 0.36: Add comments to .boot0 to make debugging a bit easier
 0.37: Remove Quiet Mode settings: now handled by Quiet Mode Schedule app
+0.38: Option to log to file if settings.log==2
diff --git a/apps/boot/bootupdate.js b/apps/boot/bootupdate.js
index daf311fe6..3001bb5c1 100644
--- a/apps/boot/bootupdate.js
+++ b/apps/boot/bootupdate.js
@@ -23,8 +23,14 @@ if (s.ble!==false) {
     boot += `bleServiceOptions.hid=Bangle.HID;\n`;
   }
 }
-if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
-  if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
+if (s.log==2) { // logging to file
+    boot += `_DBGLOG=require("Storage").open("log.txt","a");
+`;
+} if (s.blerepl===false) { // If not programmable, force terminal off Bluetooth
+  if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
+LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
+LoopbackA.setConsole(true);\n`;
+  else if (s.log) boot += `Terminal.setConsole(true);\n`; // if showing debug, force REPL onto terminal
   else boot += `E.setConsole(null,{force:true});\n`; // on new (2v05+) firmware we have E.setConsole which allows a 'null' console
   /* If not programmable add our own handler for Bluetooth data
   to allow Gadgetbridge commands to be received*/
@@ -41,7 +47,10 @@ Bluetooth.on('line',function(l) {
     try { global.GB(JSON.parse(l.slice(3,-1))); } catch(e) {}
 });\n`;
 } else {
-  if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
+  if (s.log==2) boot += `_DBGLOG=require("Storage").open("log.txt","a");
+LoopbackB.on('data',function(d) {_DBGLOG.write(d);Terminal.write(d);});
+if (!NRF.getSecurityStatus().connected) LoopbackA.setConsole();\n`;
+  else if (s.log) boot += `if (!NRF.getSecurityStatus().connected) Terminal.setConsole();\n`; // if showing debug, put REPL on terminal (until connection)
   else boot += `Bluetooth.setConsole(true);\n`; // else if no debug, force REPL to Bluetooth
 }
 // we just reset, so BLE should be on.
diff --git a/apps/setting/ChangeLog b/apps/setting/ChangeLog
index b393dda00..c676e3828 100644
--- a/apps/setting/ChangeLog
+++ b/apps/setting/ChangeLog
@@ -38,3 +38,4 @@
 0.33: Really fix 'beep' menu on Bangle.js 2 this time
 0.34: Remove Quiet Mode LCD settings: now handled by Quiet Mode Schedule app
 0.35: Change App/Widget settings to 'App Settings' so it fits on Bangle screen
+0.36: Added 'Utils' menu with helpful utilities for restoring Bangle.js
diff --git a/apps/setting/README.md b/apps/setting/README.md
index fb567030f..305c0b610 100644
--- a/apps/setting/README.md
+++ b/apps/setting/README.md
@@ -2,27 +2,26 @@
 
 This is Bangle.js's settings menu
 
-* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
 * **App/Widget Settings** settings specific to installed applications
 * **BLE** Bluetooth Settings menu - see below.
-* **Debug Info** should debug info be shown on the watch's screen or not?
 * **Beep** most Bangle.js do not have a speaker inside, but they can use the vibration motor to beep in different pitches. You can change the behaviour here to use a Piezo speaker if one is connected
 * **Vibration** enable/disable the vibration motor
 * **Quiet Mode** prevent notifications/alarms from vibrating/beeping/turning the screen on - see below
 * **Locale** set time zone/whether the clock is 12/24 hour (for supported clocks)
 * **Select Clock** if you have more than one clock face, select the default one
-* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device.
-  * **NOTE:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
 * **Set Time** Configure the current time - Note that this can be done much more easily by choosing 'Set Time' from the App Loader
 * **LCD** Configure settings about the screen. How long it stays on, how bright it is, and when it turns on - see below.
 * **Theme** Adjust the colour scheme
-* **Reset Settings** Reset the settings to defaults
+* **Utils** Utilities - including resetting settings (see below)
 * **Turn Off** Turn Bangle.js off
 
 ## BLE - Bluetooth Settings
 
+* **Make Connectable** regardless of the current Bluetooth settings, makes Bangle.js so you can connect to it (while the window is up)
 * **BLE** is Bluetooth LE enabled and the watch connectable?
 * **Programmable** if BLE is on, can the watch be connected to in order to program/upload apps? As long as your watch firmware is up to date, Gadgetbridge will work even with `Programmable` set to `Off`.
+* **HID** When Bluetooth is enabled, Bangle.js can appear as a Bluetooth Keyboard/Joystick/etc to send keypresses to a connected device.
+  * **NOTE:** on some platforms enabling HID can cause you problems when trying to connect to Bangle.js to upload apps.
 * **Passkey BETA** allows you to set a passkey that is required to connect and pair to Bangle.js. **Note:** This is Beta and you will almost certainly encounter issues connecting with Web Bluetooth using this option.
 * **Whitelist** allows you to specify only specific devices that you will let connect to your Bangle.js. Simply choose the menu item, then `Add Device`, and then connect to Bangle.js with the device you want to add. If you are already connected you will have to disconnect first. Changes will take effect when you exit the `Settings` app.
   * **NOTE:** iOS devices and newer Android devices often implement Address Randomisation and change their Bluetooth address every so often. If you device's address changes, you will be unable to connect until you update the whitelist again.
@@ -44,4 +43,16 @@ The exact effects depend on the app.  In general the watch will not wake up by i
   - Off: Normal operation
   - Alarms: Stops notifications, but "alarm" apps will still work
   - Silent: Blocks even alarms
-  
\ No newline at end of file
+
+## Utils
+
+
+* **Debug Info** should debug info be shown on the watch's screen or not?
+  * `Hide` (default) do not show debug information
+  * `Show` Show on the Bangle's screen (when not connected to Bluetooth or `Programmable:off`)
+  * `Log` Show on the Bangle's screen **and** write to a file called `log.txt` on Storage (when not connected to Bluetooth or `Programmable:off`). Warning - this file is appended to so may grow to be large if this is left enabled.
+* **Compact Storage** Removes deleted/old files from Storage - this will speed up your Bangle.js
+* **Rewrite Settings** Should not normally be required, but if `.boot0` has been deleted/corrupted (and so no settings are being loaded) this will fix it.
+* **Flatten Battery** Turns on all devices and draws as much power as possible, attempting to flatten the Bangle.js battery. This can still take 5+ hours.  
+* **Reset Settings** Reset the settings (as set in this app) to defaults. Does not reset settings for other apps.
+* **Factory Reset** (not available on Bangle.js 1) - wipe **everything** and return to a factory state
diff --git a/apps/setting/settings.js b/apps/setting/settings.js
index e00c15462..8f95eb3bb 100644
--- a/apps/setting/settings.js
+++ b/apps/setting/settings.js
@@ -95,17 +95,8 @@ function showMainMenu() {
   const mainmenu = {
     '': { 'title': 'Settings' },
     '< Back': ()=>load(),
-    'Make Connectable': ()=>makeConnectable(),
     'App Settings': ()=>showAppSettingsMenu(),
     'BLE': ()=>showBLEMenu(),
-    'Debug Info': {
-      value: settings.log,
-      format: v => v ? "Show" : "Hide",
-      onchange: () => {
-        settings.log = !settings.log;
-        updateSettings();
-      }
-    },
     'Beep': beepMenuItem,
     'Vibration': {
       value: settings.vibrate,
@@ -134,7 +125,7 @@ function showMainMenu() {
     'Set Time': ()=>showSetTimeMenu(),
     'LCD': ()=>showLCDMenu(),
     'Theme': ()=>showThemeMenu(),
-    'Reset Settings': ()=>showResetMenu(),
+    'Utils': ()=>showUtilMenu(),
     'Turn Off': ()=>{ if (Bangle.softOff) Bangle.softOff(); else Bangle.off() },
   };
 
@@ -146,6 +137,7 @@ function showBLEMenu() {
   var hidN = ["Off", "Kbrd & Media", "Kbrd","Joystick"];
   E.showMenu({
     '< Back': ()=>showMainMenu(),
+    'Make Connectable': ()=>makeConnectable(),
     'BLE': {
       value: settings.ble,
       format: boolFormat,
@@ -476,21 +468,63 @@ function showLocaleMenu() {
   return E.showMenu(localemenu);
 }
 
-function showResetMenu() {
-  const resetmenu = {
-    '': { 'title': 'Reset' },
+function showUtilMenu() {
+  var menu = {
+    '': { 'title': 'Utilities' },
     '< Back': ()=>showMainMenu(),
+    'Debug Info': {
+      value: E.clip(0|settings.log,0,2),
+      format: v => ["Hide","Show","Log"][E.clip(0|v,0,2)],
+      onchange: v => {
+        settings.log = v;
+        updateSettings();
+      }
+    },
+    'Compact Storage': () => {
+      E.showMessage("Compacting...\nTakes approx\n1 minute",{title:"Storage"});
+      require("Storage").compact();
+      showUtilMenu();
+    },
+    'Rewrite Settings': () => {
+      require("Storage").write(".boot0","eval(require('Storage').read('bootupdate.js'));");
+      load("setting.app.js");
+    },
+    'Flatten Battery': () => {
+      E.showMessage('Flattening battery - this can take hours.\nLong-press button to cancel.');
+      Bangle.setLCDTimeout(0);
+      Bangle.setLCDPower(1);
+      if (Bangle.setGPSPower) Bangle.setGPSPower(1,"flat");
+      if (Bangle.setHRMPower) Bangle.setHRMPower(1,"flat");
+      if (Bangle.setCompassPower) Bangle.setCompassPower(1,"flat");
+      if (Bangle.setBarometerPower) Bangle.setBarometerPower(1,"flat");
+      if (Bangle.setHRMPower) Bangle.setGPSPower(1,"flat");
+      setInterval(function() {
+        var i=1000;while (i--);
+      }, 1);
+    },
     'Reset Settings': () => {
-      E.showPrompt('Reset Settings?').then((v) => {
+      E.showPrompt('Reset to Defaults?',{title:"Settings"}).then((v) => {
         if (v) {
           E.showMessage('Resetting');
           resetSettings();
-        }
-        setTimeout(showMainMenu, 50);
+          setTimeout(showMainMenu, 50);
+        } else showUtilMenu();
       });
     }
   };
-  return E.showMenu(resetmenu);
+  if (Bangle.factoryReset) {
+    menu['Factory Reset'] = ()=>{
+      E.showPrompt('This will remove everything!',{title:"Factory Reset"}).then((v) => {
+        if (v) {
+          E.showMessage();
+          Terminal.setConsole();
+          Bangle.factoryReset();
+        } else showUtilMenu();
+      });
+    }
+  }
+
+  return E.showMenu(menu);
 }
 
 function makeConnectable() {

From 845a962005297ef51c05745cd721ea2a698945a7 Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 17:08:18 +0000
Subject: [PATCH 84/94] cliclocks - Load widgets after Bangle.setUI to ensure
 widgets know if they're on a clock or not (fix #970)

---
 apps.json                          |  4 ++--
 apps/cliclockJS2Enhanced/ChangeLog |  1 +
 apps/cliclockJS2Enhanced/app.js    | 13 +++++++------
 apps/cliock/ChangeLog              |  1 +
 apps/cliock/app.js                 |  8 ++++----
 5 files changed, 15 insertions(+), 12 deletions(-)

diff --git a/apps.json b/apps.json
index 50e14dec7..65dfa3188 100644
--- a/apps.json
+++ b/apps.json
@@ -1755,7 +1755,7 @@
     "id": "cliock",
     "name": "Commandline-Clock",
     "shortName": "CLI-Clock",
-    "version": "0.14",
+    "version": "0.15",
     "description": "Simple CLI-Styled Clock",
     "icon": "app.png",
     "screenshots": [{"url":"screenshot_cli.png"}],
@@ -4422,7 +4422,7 @@
     "id": "cliclockJS2Enhanced",
     "name": "Commandline-Clock JS2 Enhanced",
     "shortName": "CLI-Clock JS2",
-    "version": "0.02",
+    "version": "0.03",
     "description": "Simple CLI-Styled Clock with enhancements. Modes that are hard to use and unneded are removed (BPM, battery info, memory ect) credit to hughbarney for the original code and design. Also added HID media controlls, just swipe on the clock face to controll the media! Gadgetbride support coming soon(hopefully) Thanks to t0m1o1 for media controls!",
     "icon": "app.png",
     "screenshots": [{"url":"screengrab.png"}],
diff --git a/apps/cliclockJS2Enhanced/ChangeLog b/apps/cliclockJS2Enhanced/ChangeLog
index c7cb9e2c6..f4d146d5f 100644
--- a/apps/cliclockJS2Enhanced/ChangeLog
+++ b/apps/cliclockJS2Enhanced/ChangeLog
@@ -1,2 +1,3 @@
 0.01: Submitted to App Loader
 0.02: Removed unneded code, added HID controlls thanks to t0m1o1 for his code :p
+0.03: Load widgets after Bangle.setUI to ensure widgets know if they're on a clock or not (fix #970)
diff --git a/apps/cliclockJS2Enhanced/app.js b/apps/cliclockJS2Enhanced/app.js
index 70e86f3d6..b6172b497 100644
--- a/apps/cliclockJS2Enhanced/app.js
+++ b/apps/cliclockJS2Enhanced/app.js
@@ -50,7 +50,7 @@ if (next) {
       setTimeout(drawApp, 1000);
       Bangle.setLocked(true);
   }, BTN1, { edge:"falling",repeat:true,debounce:50});
-  Bangle.on('drag', function(e) {  
+  Bangle.on('drag', function(e) {
     if(!e.b){
       console.log(lasty);
       console.log(lastx);
@@ -91,7 +91,7 @@ if (next) {
             lasty = lasty + e.dy;
   }
   });
-  
+
 }
 
 
@@ -144,14 +144,15 @@ function writeLine(str,line){
 }
 
 g.clear();
-Bangle.loadWidgets();
-Bangle.drawWidgets();
-drawAll();
+
 Bangle.on('lcdPower',function(on) {
   if (on) drawAll();
 });
 var click = setInterval(updateTime, 1000);
 // Show launcher when button pressed
 Bangle.setUI("clockupdown", btn=>{
-  drawAll();
+  drawAll(); // why do we redraw here??
 });
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+drawAll();
diff --git a/apps/cliock/ChangeLog b/apps/cliock/ChangeLog
index 2a93a0d5f..68249b622 100644
--- a/apps/cliock/ChangeLog
+++ b/apps/cliock/ChangeLog
@@ -7,3 +7,4 @@
 0.13: Use setUI, work with smaller screens and themes
 0.14: Fix BTN1 (fix #853)
       Add light/dark theme support
+0.15: Load widgets after Bangle.setUI to ensure widgets know if they're on a clock or not (fix #970)
diff --git a/apps/cliock/app.js b/apps/cliock/app.js
index 0fd6ea580..d9271bf15 100644
--- a/apps/cliock/app.js
+++ b/apps/cliock/app.js
@@ -183,9 +183,6 @@ Bangle.on('HRM', function(hrm) {
 });
 
 g.clear();
-Bangle.loadWidgets();
-Bangle.drawWidgets();
-drawAll();
 Bangle.on('lcdPower',function(on) {
   if (on) drawAll();
 });
@@ -195,4 +192,7 @@ Bangle.setUI("clockupdown", btn=>{
   if (btn<0) changeInfoMode();
   if (btn>0) changeFunctionMode();
   drawAll();
-});
\ No newline at end of file
+});
+Bangle.loadWidgets();
+Bangle.drawWidgets();
+drawAll();

From cc79881719061f2f8bbca6c2888ae76dcbfff9b6 Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 17:09:40 +0000
Subject: [PATCH 85/94] fix after #1018

---
 apps.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps.json b/apps.json
index 62e317df1..cce0b3f36 100644
--- a/apps.json
+++ b/apps.json
@@ -2419,7 +2419,7 @@
       {"name":"calendar.settings.js","url":"settings.js"},
       {"name":"calendar.img","url":"calendar-icon.js","evaluate":true}
     ],
-    "data": [{"name":"messages.json"}]
+    "data": [{"name":"calendar.json"}]
   },
   {
     "id": "hidjoystick",

From a45f7506ffbbcb622ebf791605627eabce994888 Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Thu, 9 Dec 2021 17:16:55 +0000
Subject: [PATCH 86/94] more app.json fixes, remove warning about settings as
 it seems nobody cares

---
 apps.json          | 4 ++--
 bin/sanitycheck.js | 4 ++--
 2 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/apps.json b/apps.json
index cce0b3f36..1c37cfd56 100644
--- a/apps.json
+++ b/apps.json
@@ -4095,7 +4095,7 @@
       {"name":"carcrazy.img","url":"app-icon.js","evaluate":true},
       {"name":"carcrazy.settings.js","url":"settings.js"}
     ],
-    "data": [{"name":"app.json"}]
+    "data": [{"name":"CarCrazy.csv"}]
   },
   {
     "id": "shortcuts",
@@ -4537,7 +4537,7 @@
       {"name":"schoolCalendar.img","url":"app-icon.js","evaluate":true}
     ],
     "data": [
-      {"name":"app.json"}
+      {"name":"calendarItems.csv"}
     ]
   },
   { "id": "timecal",
diff --git a/bin/sanitycheck.js b/bin/sanitycheck.js
index ea45dc19b..572364224 100755
--- a/bin/sanitycheck.js
+++ b/bin/sanitycheck.js
@@ -207,10 +207,10 @@ apps.forEach((app,appIdx) => {
     }
   });
   // prefer "appid.json" over "appid.settings.json" (TODO: change to ERROR once all apps comply?)
-  if (dataNames.includes(app.id+".settings.json") && !dataNames.includes(app.id+".json"))
+ /* if (dataNames.includes(app.id+".settings.json") && !dataNames.includes(app.id+".json"))
     WARN(`App ${app.id} uses data file ${app.id+'.settings.json'} instead of ${app.id+'.json'}`)
   else if (dataNames.includes(app.id+".settings.json"))
-    WARN(`App ${app.id} uses data file ${app.id+'.settings.json'}`)
+    WARN(`App ${app.id} uses data file ${app.id+'.settings.json'}`)*/
   // settings files should be listed under data, not storage (TODO: change to ERROR once all apps comply?)
   if (fileNames.includes(app.id+".settings.json"))
     WARN(`App ${app.id} uses storage file ${app.id+'.settings.json'} instead of data file`)

From 4ce0e39263c9ac07b641a4a285f46f17cae9a04f Mon Sep 17 00:00:00 2001
From: Richard de Boer 
Date: Thu, 9 Dec 2021 20:17:11 +0100
Subject: [PATCH 87/94] gbmusic: Fix scrolling title background color

---
 apps.json              | 2 +-
 apps/gbmusic/ChangeLog | 1 +
 apps/gbmusic/app.js    | 2 +-
 3 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/apps.json b/apps.json
index 1c37cfd56..50a731430 100644
--- a/apps.json
+++ b/apps.json
@@ -3795,7 +3795,7 @@
     "id": "gbmusic",
     "name": "Gadgetbridge Music Controls",
     "shortName": "Music Controls",
-    "version": "0.07",
+    "version": "0.08",
     "description": "Control the music on your Gadgetbridge-connected phone",
     "icon": "icon.png",
     "screenshots": [{"url":"screenshot_v1.png"},{"url":"screenshot_v2.png"}],
diff --git a/apps/gbmusic/ChangeLog b/apps/gbmusic/ChangeLog
index 9cebf0a31..316b98a84 100644
--- a/apps/gbmusic/ChangeLog
+++ b/apps/gbmusic/ChangeLog
@@ -5,3 +5,4 @@
 0.05: Setting to disable double/triple press control, remove touch controls setting, reduce fadeout flicker
 0.06: Bangle.js 2 support
 0.07: Fix "previous" button image
+0.08: Fix scrolling title background color
diff --git a/apps/gbmusic/app.js b/apps/gbmusic/app.js
index f514dfccd..1bddf70f7 100644
--- a/apps/gbmusic/app.js
+++ b/apps/gbmusic/app.js
@@ -91,7 +91,7 @@ function rScroller(l) {
     y = l.y+l.h/2;
   l.offset = l.offset%w;
   g.setClipRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1)
-    .setColor(l.col)
+    .setColor(l.col).setBgColor(l.bgCol) // need to set colors: iScroll calls this function outside Layout
     .setFontAlign(-1, 0) // left center
     .clearRect(l.x, l.y, l.x+l.w-1, l.y+l.h-1)
     .drawString(l.label, l.x-l.offset+40, y)

From c9ffee04a74ac44896be2bc8baaa21c11122725f Mon Sep 17 00:00:00 2001
From: Richard de Boer 
Date: Thu, 9 Dec 2021 20:54:39 +0100
Subject: [PATCH 88/94] messages: Open app when touching the widget

---
 apps.json               | 2 +-
 apps/messages/ChangeLog | 3 ++-
 apps/messages/widget.js | 6 ++++++
 3 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/apps.json b/apps.json
index 1c37cfd56..e7df56c13 100644
--- a/apps.json
+++ b/apps.json
@@ -57,7 +57,7 @@
   {
     "id": "messages",
     "name": "Messages",
-    "version": "0.10",
+    "version": "0.11",
     "description": "App to display notifications from iOS and Gadgetbridge",
     "icon": "app.png",
     "type": "app",
diff --git a/apps/messages/ChangeLog b/apps/messages/ChangeLog
index 269a2cf62..a3a4f377c 100644
--- a/apps/messages/ChangeLog
+++ b/apps/messages/ChangeLog
@@ -12,4 +12,5 @@
       buzz on new message (fix #999)
 0.09: Message now disappears after 60s if no action taken and clock loads (fix 922)
       Fix phone icon (#1014)
-0.10: Respect the 'new' attribute if it was set from iOS integrations
\ No newline at end of file
+0.10: Respect the 'new' attribute if it was set from iOS integrations
+0.11: Open app when touching the widget (Bangle.js 2 only)
\ No newline at end of file
diff --git a/apps/messages/widget.js b/apps/messages/widget.js
index 245a303fc..6403c6b8d 100644
--- a/apps/messages/widget.js
+++ b/apps/messages/widget.js
@@ -1,4 +1,5 @@
 WIDGETS["messages"]={area:"tl",width:0,draw:function() {
+  Bangle.removeListener('touch', this.touch);
   if (!this.width) return;
   var c = (Date.now()-this.t)/1000;
   g.reset().setBgColor((c&1) ? "#0f0" : "#030").setColor((c&1) ? "#000" : "#fff");
@@ -12,6 +13,7 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
     WIDGETS["messages"].buzz(); // buzz every 4 seconds
   }
   setTimeout(()=>WIDGETS["messages"].draw(), 1000);
+  if (process.env.HWVERSION>1) Bangle.on('touch', this.touch);
 },show:function(quiet) {
   WIDGETS["messages"].t=Date.now(); // first time
   WIDGETS["messages"].l=Date.now()-10000; // last buzz
@@ -33,6 +35,10 @@ WIDGETS["messages"]={area:"tl",width:0,draw:function() {
     if (c=="-") Bangle.buzz(500).then(()=>setTimeout(b,100));
   }
   b();
+},touch:function(b,c) {
+  var w=WIDGETS["messages"];
+  if (!w||!w.width||c.xw.x+w.width||c.yw.y+23) return;
+  load("messages.app.js");
 }};
 /* We might have returned here if we were in the Messages app for a
 message but then the watch was never viewed. In that case we don't

From f8628dd26d587edff90037bcd255aacbdddaafcc Mon Sep 17 00:00:00 2001
From: Marco H 
Date: Fri, 10 Dec 2021 08:58:44 +0100
Subject: [PATCH 89/94] Update app.js

Load steps from Health Tracking app (if installed)
---
 apps/clicompleteclk/app.js | 45 +++++++++++++++++++++++---------------
 1 file changed, 27 insertions(+), 18 deletions(-)

diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js
index 89dbce919..77dc22db6 100644
--- a/apps/clicompleteclk/app.js
+++ b/apps/clicompleteclk/app.js
@@ -68,7 +68,7 @@ function drawInfo(now) {
   */
 
   // weather
-  var weatherJson = getWeather();
+  const weatherJson = getWeather();
   if(weatherJson && weatherJson.weather){
     const currentWeather = weatherJson.weather;
 
@@ -84,9 +84,9 @@ function drawInfo(now) {
   }
 
   // steps
-  if (stepsWidget() != undefined) {
+  const steps = getSteps();
+  if (steps != undefined) {
     writeLineTopic("STEP", i);
-    const steps = stepsWidget().getSteps();
     writeLine(steps, i);
     i++;
   }
@@ -128,6 +128,30 @@ function writeLine(str,line,pColor){
   g.drawString(str,marginLeftData,y);
 }
 
+
+function getSteps() {
+  var steps = 0;
+  let health;
+  try {
+    health = require("health");
+  } catch (e) {
+    // Module health not found
+  }
+  if (health != undefined) {
+    health.readDay(new Date(), h=>steps+=h.steps);
+  } else if (WIDGETS.wpedom !== undefined) {
+    return WIDGETS.wpedom.getSteps();
+  } else if (WIDGETS.activepedom !== undefined) {
+    return WIDGETS.activepedom.getSteps();
+  }
+  return steps;
+}
+
+function getWeather() {
+  let jsonWeather = storage.readJSON('weather.json');
+  return jsonWeather;
+}
+
 // EVENTS:
 
 // turn on HRM when the LCD is unlocked
@@ -166,21 +190,6 @@ Bangle.on('HRM', function(hrm) {
   //}
 });
 
-
-function stepsWidget() {
-  if (WIDGETS.activepedom !== undefined) {
-    return WIDGETS.activepedom;
-  } else if (WIDGETS.wpedom !== undefined) {
-    return WIDGETS.wpedom;
-  }
-  return undefined;
-}
-
-function getWeather() {
-  let jsonWeather = storage.readJSON('weather.json');
-  return jsonWeather;
-}
-
 g.clear();
 Bangle.setUI("clock");
 Bangle.loadWidgets();

From 87acbe83e59c2d3f1034e09a8467a3fd12e06348 Mon Sep 17 00:00:00 2001
From: Marco H 
Date: Fri, 10 Dec 2021 08:58:52 +0100
Subject: [PATCH 90/94] Update README.md

---
 apps/clicompleteclk/README.md | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/apps/clicompleteclk/README.md b/apps/clicompleteclk/README.md
index e182b55fd..62fdbbc61 100644
--- a/apps/clicompleteclk/README.md
+++ b/apps/clicompleteclk/README.md
@@ -6,9 +6,8 @@ It can show the following (depending on availability) information:
 * Time
 * Day of week
 * Date
-* Weather condition (requires weather app)
-* Temperature (requires weather app)
-* Steps (requires a step widget)
+* Weather conditions and temperature (requires app [Weather](https://banglejs.com/apps/#weather))
+* Steps (requires app [Health Tracking](https://banglejs.com/apps/#health%20tracking) or a step widget)
 * Heart rate (when screen is on and unlocked)
 
 ## TODO

From 24b5937295fc8f84288b3932656a2db187812cf3 Mon Sep 17 00:00:00 2001
From: Marco H 
Date: Fri, 10 Dec 2021 09:09:21 +0100
Subject: [PATCH 91/94] ChangeLog: v.0.02

---
 apps/clicompleteclk/ChangeLog | 1 +
 1 file changed, 1 insertion(+)

diff --git a/apps/clicompleteclk/ChangeLog b/apps/clicompleteclk/ChangeLog
index 85b5360ad..ee05bd582 100644
--- a/apps/clicompleteclk/ChangeLog
+++ b/apps/clicompleteclk/ChangeLog
@@ -1 +1,2 @@
 0.01: New clock!
+0.02: Load steps from Health Tracking app (if installed)

From f3531c81602ab35e5f15d16f4919d56dbfd2e4c9 Mon Sep 17 00:00:00 2001
From: Marco H 
Date: Fri, 10 Dec 2021 09:27:10 +0100
Subject: [PATCH 92/94] Update apps.json

---
 apps.json | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/apps.json b/apps.json
index 1c37cfd56..1c8efd59b 100644
--- a/apps.json
+++ b/apps.json
@@ -4845,7 +4845,7 @@
   { "id": "clicompleteclk",
   "name": "CLI complete clock",
   "shortName":"CLI cmplt clock",
-  "version":"0.01",
+  "version":"0.02",
   "description": "Command line styled clock with lots of information",
   "icon": "app.png",
   "allow_emulator": true,

From 25543abb11401c11bbb982bc38adc87cef9690ee Mon Sep 17 00:00:00 2001
From: Marco H 
Date: Fri, 10 Dec 2021 11:39:16 +0100
Subject: [PATCH 93/94] Update app.js

Do not overwrite old heart rate value with '...'
---
 apps/clicompleteclk/app.js | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

diff --git a/apps/clicompleteclk/app.js b/apps/clicompleteclk/app.js
index 77dc22db6..7fbdabcc1 100644
--- a/apps/clicompleteclk/app.js
+++ b/apps/clicompleteclk/app.js
@@ -103,8 +103,6 @@ function drawHeartRate(i) {
       writeLine(hrtValue,i);
     else
       writeLine(hrtValue,i, topicColor);
-  } else {
-    writeLine("...",i);
   }
   lastHeartRateRowIndex = i;
 }
@@ -162,11 +160,11 @@ Bangle.on('lock', function(isLocked) {
       hrtValue = "...";
     else
       hrtValueIsOld = true;
-    drawHeartRate();
   } else {
     hrtValueIsOld = true;
     Bangle.setHRMPower(0,"clicompleteclk");
   }
+  drawHeartRate();
 });
 
 Bangle.on('lcdPower',function(on) {

From 6b2f8e98d3a36c392b901e673763f5daeeea59a3 Mon Sep 17 00:00:00 2001
From: Gordon Williams 
Date: Fri, 10 Dec 2021 20:09:14 +0000
Subject: [PATCH 94/94] oops - fix firmware loader issues

---
 apps/fwupdate/custom.html | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/apps/fwupdate/custom.html b/apps/fwupdate/custom.html
index 4ee99479b..b5c79a325 100644
--- a/apps/fwupdate/custom.html
+++ b/apps/fwupdate/custom.html
@@ -85,7 +85,7 @@ function checkForFileOnServer() {
   	});
   }
 
-  var regex = new RegExp("_banglejs2");
+  var regex = new RegExp("_banglejs2.*zip$");
 
 	var domFirmwareList = document.getElementById("latest-firmware-list");
   var domFirmware = document.getElementById("latest-firmware");
@@ -107,7 +107,7 @@ function checkForFileOnServer() {
 			});
       console.log("Finished check for firmware files...");
       var fwlinks = document.querySelectorAll(".fw-link");
-      for (var i=0;i {
           e.preventDefault();
           var url = e.target.href;