diff --git a/apps/android/ChangeLog b/apps/android/ChangeLog index 0ed05817d..11c78588a 100644 --- a/apps/android/ChangeLog +++ b/apps/android/ChangeLog @@ -35,3 +35,5 @@ 0.33: Fix alarms created in Gadgetbridge not repeating 0.34: Implement API for activity tracks fetching (Recorder app logs). 0.35: Implement API to enable/disable acceleration data tracking. +0.36: Move from wrapper function to {} and let - faster execution at boot + Allow `calendar-` to take an array of items to remove \ No newline at end of file diff --git a/apps/android/boot.js b/apps/android/boot.js index c12513141..729ed2b47 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -1,22 +1,22 @@ /* global GB */ -(function() { - function gbSend(message) { +{ + let gbSend = function(message) { Bluetooth.println(""); Bluetooth.println(JSON.stringify(message)); } - var lastMsg; // for music messages - may not be needed now... - var actInterval; // Realtime activity reporting interval when `act` is true - var actHRMHandler; // For Realtime activity reporting - var gpsState = {}; // keep information on GPS via Gadgetbridge + let lastMsg; // for music messages - may not be needed now... + let actInterval; // Realtime activity reporting interval when `act` is true + let actHRMHandler; // For Realtime activity reporting + let gpsState = {}; // keep information on GPS via Gadgetbridge // this settings var is deleted after this executes to save memory - var settings = require("Storage").readJSON("android.settings.json",1)||{}; + let settings = require("Storage").readJSON("android.settings.json",1)||{}; //default alarm settings if (settings.rp == undefined) settings.rp = true; if (settings.as == undefined) settings.as = true; if (settings.vibrate == undefined) settings.vibrate = ".."; require('Storage').writeJSON("android.settings.json", settings); - var _GB = global.GB; + let _GB = global.GB; let fetchRecInterval; global.GB = (event) => { // feed a copy to other handlers if there were any @@ -122,7 +122,10 @@ var cal = require("Storage").readJSON("android.calendar.json",true); //if any of those happen we are out of sync! if (!cal || !Array.isArray(cal)) cal = []; - cal = cal.filter(e=>e.id!=event.id); + if (Array.isArray(event.id)) + cal = cal.filter(e=>!event.id.includes(e.id)); + else + cal = cal.filter(e=>e.id!=event.id); require("Storage").writeJSON("android.calendar.json", cal); }, //triggered by GB, send all ids @@ -337,7 +340,7 @@ }; // Battery monitor - function sendBattery() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); } + let sendBattery = function() { gbSend({ t: "status", bat: E.getBattery(), chg: Bangle.isCharging()?1:0 }); } Bangle.on("charging", sendBattery); NRF.on("connect", () => setTimeout(function() { sendBattery(); @@ -432,4 +435,4 @@ // remove settings object so it's not taking up RAM delete settings; -})(); +} diff --git a/apps/android/metadata.json b/apps/android/metadata.json index 95fd60854..7768efb6c 100644 --- a/apps/android/metadata.json +++ b/apps/android/metadata.json @@ -2,7 +2,7 @@ "id": "android", "name": "Android Integration", "shortName": "Android", - "version": "0.35", + "version": "0.36", "description": "Display notifications/music/etc sent from the Gadgetbridge app on Android. This replaces the old 'Gadgetbridge' Bangle.js widget.", "icon": "app.png", "tags": "tool,system,messages,notifications,gadgetbridge", diff --git a/apps/clkinfocal/ChangeLog b/apps/clkinfocal/ChangeLog index e3c19f0ba..ccb73b648 100644 --- a/apps/clkinfocal/ChangeLog +++ b/apps/clkinfocal/ChangeLog @@ -1,4 +1,5 @@ 0.01: New App! 0.02: added settings options to change date format 0.03: Remove un-needed font requirement, now outputs transparent image -0.04: Fix image after 0.03 regression \ No newline at end of file +0.04: Fix image after 0.03 regression +0.05: Remove duplicated day in calendar when format setting is 'dd MMM' \ No newline at end of file diff --git a/apps/clkinfocal/clkinfo.js b/apps/clkinfocal/clkinfo.js index 893549399..dc93ddd0e 100644 --- a/apps/clkinfocal/clkinfo.js +++ b/apps/clkinfocal/clkinfo.js @@ -5,7 +5,7 @@ var getDateString = function(dt) { switch(settings.fmt) { case "dd MMM": - return '' + dt.getDate() + ' ' + require("locale").month(dt,1).toUpperCase(); + return require("locale").month(dt,1).toUpperCase(); case "DDD dd": return require("locale").dow(dt,1).toUpperCase() + ' ' + dt.getDate(); default: // DDD diff --git a/apps/clkinfocal/metadata.json b/apps/clkinfocal/metadata.json index 0bdcb5178..71dc811e9 100644 --- a/apps/clkinfocal/metadata.json +++ b/apps/clkinfocal/metadata.json @@ -1,6 +1,6 @@ { "id": "clkinfocal", "name": "Calendar Clockinfo", - "version":"0.04", + "version":"0.05", "description": "For clocks that display 'clockinfo' (messages that can be cycled through using the clock_info module) this displays the day of the month in the icon, and the weekday. There is also a settings menu to select the format of the text", "icon": "app.png", "screenshots": [{"url":"screenshot.png"}], diff --git a/apps/promenu/ChangeLog b/apps/promenu/ChangeLog index e06007c98..0cbb4fdba 100644 --- a/apps/promenu/ChangeLog +++ b/apps/promenu/ChangeLog @@ -5,3 +5,5 @@ functionality, both via `.back` and `"< Back"` items, displaying an entry and the `setUI` back widget. Fix `setUI`'s back overwrite. Add support for scroll. +0.05: Fix display of final menu item when no options are given and + handling of E.showMenu() with no arguments diff --git a/apps/promenu/bootb2.js b/apps/promenu/bootb2.js index 87d6e4a54..a41b8cb06 100644 --- a/apps/promenu/bootb2.js +++ b/apps/promenu/bootb2.js @@ -12,12 +12,10 @@ E.showMenu = function (items) { g.fillPoly(RectRnd(x1, y1, x2, y2, r)); g.setColor(255, 255, 255); }; + var options = items && items[""] || {}; + if (items) + delete items[""]; var menuItems = Object.keys(items); - var options = items[""] || {}; - if (!(options instanceof Object)) - options = {}; - if (options) - menuItems.splice(menuItems.indexOf(""), 1); var fontHeight = options.fontHeight || 25; var selected = options.scroll || options.selected || 0; var ar = Bangle.appRect; @@ -144,7 +142,7 @@ E.showMenu = function (items) { l.draw(); var back = options.back; if (!back) { - var backItem = items["< Back"]; + var backItem = items && items["< Back"]; if (typeof backItem === "function") back = backItem; else if (backItem && "back" in backItem) diff --git a/apps/promenu/bootb2.ts b/apps/promenu/bootb2.ts index c3ec89bea..abc243c45 100644 --- a/apps/promenu/bootb2.ts +++ b/apps/promenu/bootb2.ts @@ -1,6 +1,6 @@ type ActualMenuItem = Exclude