Skip to content

Commit 6c801bd

Browse files
committed
messagegui: Fix bugs related to empty titles and bodies.
Fixes #3969. Notification events can now have title or body as empty strings or `undefined` without errors. Tested from console using the below notification messages sent from console. Prior to this commit, all but the two marked test messages created errors. GB({"t":"notify", "id":987123, "title":"Title"}) GB({"t":"notify", "id":987124, "title":"Title", "body":""}) GB({"t":"notify", "id":987125, "body":"Body"}) GB({"t":"notify", "id":987126, "title":"", "body":"Body"}) // worked before this commit GB({"t":"notify", "id":987127, "title":""}) GB({"t":"notify", "id":987128, "body":""}) GB({"t":"notify", "id":987129}) // does nothing
1 parent 91cf1ca commit 6c801bd

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

apps/messagegui/ChangeLog

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,5 @@
117117
Remove workaround for 2v10 (>3 years ago) - assume everyone is on never firmware now
118118
0.86: Default to showing message scroller (with title, bigger icon)
119119
0.87: Make choosing of font size more repeatable
120-
0.88: Adjust padding calculation so messages are spaced out properly even when using international fonts
120+
0.88: Adjust padding calculation so messages are spaced out properly even when using international fonts
121+
0.89: Fix bugs related to empty titles and bodies

apps/messagegui/app.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -361,12 +361,12 @@ function showMessage(msgid, persist) {
361361
active = "message";
362362
// Normal text message display
363363
let src=msg.src||/*LANG*/"Message", srcFont = fontSmall;
364-
let title=msg.title, titleFont = fontLarge, lines;
364+
let title=msg.title||"", titleFont = fontLarge, lines=[];
365365
let body=msg.body, bodyFont = fontLarge;
366366
// If no body, use the title text instead...
367-
if (body===undefined) {
367+
if (!body) {
368368
body = title;
369-
title = undefined;
369+
title = "";
370370
}
371371
if (g.setFont(srcFont).stringWidth(src) > g.getWidth()-52)
372372
srcFont = "4x6";

apps/messagegui/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"id": "messagegui",
33
"name": "Message UI",
44
"shortName": "Messages",
5-
"version": "0.88",
5+
"version": "0.89",
66
"description": "Default app to display notifications from iOS and Gadgetbridge/Android",
77
"icon": "app.png",
88
"type": "app",

0 commit comments

Comments
 (0)