Skip to content

Commit a252d71

Browse files
authored
Merge pull request #3972 from randyheydon/messagegui_3969
messagegui: Fix bugs related to empty titles and bodies.
2 parents e8aee92 + e3394cc commit a252d71

File tree

3 files changed

+8
-5
lines changed

3 files changed

+8
-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: 5 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";
@@ -392,6 +392,8 @@ function showMessage(msgid, persist) {
392392
}
393393
lines = g.setFont(bodyFont).wrapString(body, w);
394394
}
395+
// By this point, `title` must be a string and `lines` must be an array of strings.
396+
// Either or both can be empty, but neither can be `undefined` (#3969).
395397
let negHandler,posHandler,rowLeftDraw,rowRightDraw;
396398
if (msg.negative) {
397399
negHandler = ()=>{

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)