diff --git a/apps/android/ChangeLog b/apps/android/ChangeLog index 11c78588a..e20b30304 100644 --- a/apps/android/ChangeLog +++ b/apps/android/ChangeLog @@ -36,4 +36,5 @@ 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 + Allow `calendar-` to take an array of items to remove +0.37: Support Gadgetbridge canned responses \ No newline at end of file diff --git a/apps/android/boot.js b/apps/android/boot.js index 729ed2b47..17d4033b1 100644 --- a/apps/android/boot.js +++ b/apps/android/boot.js @@ -67,6 +67,9 @@ title:event.name||/*LANG*/"Call", body:/*LANG*/"Incoming call\n"+event.number}); require("messages").pushMessage(event); }, + "canned_responses_sync" : function() { + require("Storage").writeJSON("replies.json", event.d); + }, // {"t":"alarm", "d":[{h:int,m:int,rep:int},... } "alarm" : function() { //wipe existing GB alarms diff --git a/apps/android/metadata.json b/apps/android/metadata.json index 7768efb6c..210e711f2 100644 --- a/apps/android/metadata.json +++ b/apps/android/metadata.json @@ -2,7 +2,7 @@ "id": "android", "name": "Android Integration", "shortName": "Android", - "version": "0.36", + "version": "0.37", "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/reply/ChangeLog b/apps/reply/ChangeLog index a5a65b116..ae117133c 100644 --- a/apps/reply/ChangeLog +++ b/apps/reply/ChangeLog @@ -1,2 +1,3 @@ 0.01: New Library! -0.02: Minor bug fixes \ No newline at end of file +0.02: Minor bug fixes +0.03: Support Gadgetbridge canned responses \ No newline at end of file diff --git a/apps/reply/lib.js b/apps/reply/lib.js index cdf394bb4..50d22e6ba 100644 --- a/apps/reply/lib.js +++ b/apps/reply/lib.js @@ -46,11 +46,20 @@ exports.reply = function (options) { options.fileOverride || "replies.json", true ) || []; + replies.forEach((reply) => { - menu = Object.defineProperty(menu, reply.text, { + var displayString = reply.disp ?? reply.text; + var truncatedDisplayString = g.wrapString(displayString, 120); + // Generally handles truncating nicely, but falls down in long runs of emoji since they count as one image + if (truncatedDisplayString.length > 1) { + truncatedDisplayString = truncatedDisplayString.slice(0,1); + truncatedDisplayString[truncatedDisplayString.length-1] += "..."; + } + menu = Object.defineProperty(menu, truncatedDisplayString, { value: () => constructReply(options.msg ?? {}, reply.text, resolve, reject), }); }); + if (!keyboard) delete menu[/*LANG*/ "Compose"]; if (replies.length == 0) { diff --git a/apps/reply/metadata.json b/apps/reply/metadata.json index c028ed053..7f1dd6812 100644 --- a/apps/reply/metadata.json +++ b/apps/reply/metadata.json @@ -1,6 +1,6 @@ { "id": "reply", "name": "Reply Library", - "version": "0.02", + "version": "0.03", "description": "A library for replying to text messages via predefined responses or keyboard", "icon": "app.png", "type": "module",