messages: Handle text with images in messages list by just displaying the first line

master
Gordon Williams 2023-11-17 16:18:53 +00:00
parent 8f67f1a8d8
commit 9aefeb9fe6
3 changed files with 11 additions and 6 deletions

View File

@ -100,4 +100,5 @@
On 2v18.64+ firmware, 'No Messages' now has a 'back' button
0.72: Nav message updastes don't automatically launch navigation menu unless they're new
0.73: Add sharp left+right nav icons
0.74: Add option for driving on left (affects roundabout icons in navigation)
0.74: Add option for driving on left (affects roundabout icons in navigation)
0.75: Handle text with images in messages list by just displaying the first line

View File

@ -446,7 +446,7 @@ function checkMessages(options) {
if (options.clockIfAllRead && newMessages.length==0)
return load();
active = "list";
// Otherwise show a menu
// Otherwise show a list of messages
E.showScroller({
h : 48,
c : Math.max(MESSAGES.length,3), // workaround for 2v10.219 firmware (min 3 not needed for 2v11)
@ -469,16 +469,20 @@ function checkMessages(options) {
.setColor(fg); // only color the icon
x += 50;
}
var m = msg.title+"\n"+msg.body, longBody=false;
if (title) g.setFontAlign(-1,-1).setFont(fontBig).drawString(title, x,r.y+2);
var longBody = false;
if (body) {
g.setFontAlign(-1,-1).setFont("6x8");
// if the body includes an image, it probably won't be small enough to allow>1 line
var maxLines = 3;
if (body.includes("\0")) maxLines=1;
var l = g.wrapString(body, r.w-(x+14));
if (l.length>3) {
l = l.slice(0,3);
if (l.length>maxLines) {
l = l.slice(0,maxLines);
l[l.length-1]+="...";
}
longBody = l.length>2;
// draw the body
g.drawString(l.join("\n"), x+10,r.y+20);
}
if (!longBody && msg.src) g.setFontAlign(1,1).setFont("6x8").drawString(msg.src, r.x+r.w-2, r.y+r.h-2);

View File

@ -2,7 +2,7 @@
"id": "messagegui",
"name": "Message UI",
"shortName": "Messages",
"version": "0.74",
"version": "0.75",
"description": "Default app to display notifications from iOS and Gadgetbridge/Android",
"icon": "app.png",
"type": "app",