Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Gadgetbridge Canned Responses #3556

Merged
merged 2 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/android/ChangeLog
Original file line number Diff line number Diff line change
Expand Up @@ -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
Allow `calendar-` to take an array of items to remove
0.37: Support Gadgetbridge canned responses
3 changes: 3 additions & 0 deletions apps/android/boot.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion apps/android/metadata.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 2 additions & 1 deletion apps/reply/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
0.01: New Library!
0.02: Minor bug fixes
0.02: Minor bug fixes
0.03: Support Gadgetbridge canned responses
12 changes: 10 additions & 2 deletions apps/reply/lib.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,19 @@ 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 wrappedDisplayString = g.wrapString(displayString, 120);
// Generally handles truncating nicely, but falls down in long runs of emoji since they count as one image
if (wrappedDisplayString.length > 1) {
displayString = wrappedDisplayString[0]+"...";
}
menu = Object.defineProperty(menu, displayString, {
value: () => constructReply(options.msg ?? {}, reply.text, resolve, reject),
});
});

if (!keyboard) delete menu[/*LANG*/ "Compose"];

if (replies.length == 0) {
Expand All @@ -75,4 +83,4 @@ exports.reply = function (options) {
E.showMenu(menu);
}
});
};
};
2 changes: 1 addition & 1 deletion apps/reply/metadata.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
Loading