1
0
Fork 0

Merge remote-tracking branch 'upstream/master'

master
Danny 2022-01-12 10:40:37 +01:00
commit 9b25177dd1
3 changed files with 38 additions and 5 deletions

View File

@ -77,7 +77,7 @@
{ {
"id": "messages", "id": "messages",
"name": "Messages", "name": "Messages",
"version": "0.17", "version": "0.18",
"description": "App to display notifications from iOS and Gadgetbridge", "description": "App to display notifications from iOS and Gadgetbridge",
"icon": "app.png", "icon": "app.png",
"type": "app", "type": "app",

View File

@ -24,3 +24,7 @@
0.15: Don't buzz when Quiet Mode is active 0.15: Don't buzz when Quiet Mode is active
0.16: Fix text wrapping so it fits the screen even if title is big (fix #1147) 0.16: Fix text wrapping so it fits the screen even if title is big (fix #1147)
0.17: Fix: Get dynamic dimensions of notify icon, fixed notification font 0.17: Fix: Get dynamic dimensions of notify icon, fixed notification font
0.18: Use app-specific icon colors
Spread message action buttons out
Back button now goes back to list of messages
If showMessage called with no message (eg all messages deleted) now return to the clock (fix #1267)

View File

@ -101,6 +101,31 @@ function getMessageImage(msg) {
if (msg.id=="back") return getBackImage(); if (msg.id=="back") return getBackImage();
return getNotificationImage(); return getNotificationImage();
} }
function getMessageImageCol(msg,def) {
return {
// generic colors, using B2-safe colors
"calendar": "#f00",
"mail": "#ff0",
"music": "#f0f",
"phone": "#0f0",
"sms message": "#0ff",
// brands, according to https://www.schemecolor.com/?s (picking one for multicolored logos)
// all dithered on B2, but we only use the color for the icons. (Could maybe pick the closest 3-bit color for B2?)
"facebook": "#4267b2",
"gmail": "#ea4335",
"google home": "#fbbc05",
"hangouts": "#1ba261",
"instagram": "#dd2a7b",
"messenger": "#0078ff",
"outlook mail": "#0072c6",
"skype": "#00aff0",
"slack": "#e51670",
"telegram": "#0088cc",
"twitter": "#1da1f2",
"whatsapp": "#4fce5d",
"wordfeud": "#dcc8bd",
}[(msg.src||"").toLowerCase()]||(def !== undefined?def:g.theme.fg);
}
function showMapMessage(msg) { function showMapMessage(msg) {
var m; var m;
@ -200,7 +225,7 @@ function showMessageSettings(msg) {
function showMessage(msgid) { function showMessage(msgid) {
var msg = MESSAGES.find(m=>m.id==msgid); var msg = MESSAGES.find(m=>m.id==msgid);
if (!msg) return checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0}); // go home if no message found if (!msg) return checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0}); // go home if no message found
if (msg.src=="Maps") { if (msg.src=="Maps") {
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
return showMapMessage(msg); return showMapMessage(msg);
@ -224,10 +249,11 @@ function showMessage(msgid) {
{type:"btn", src:getBackImage(), cb:()=>{ {type:"btn", src:getBackImage(), cb:()=>{
msg.new = false; saveMessages(); // read mail msg.new = false; saveMessages(); // read mail
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:1}); checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0});
}} // back }} // back
]; ];
if (msg.positive) { if (msg.positive) {
buttons.push({fillx:1});
buttons.push({type:"btn", src:getPosImage(), cb:()=>{ buttons.push({type:"btn", src:getPosImage(), cb:()=>{
msg.new = false; saveMessages(); msg.new = false; saveMessages();
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
@ -236,6 +262,7 @@ function showMessage(msgid) {
}}); }});
} }
if (msg.negative) { if (msg.negative) {
buttons.push({fillx:1});
buttons.push({type:"btn", src:getNegImage(), cb:()=>{ buttons.push({type:"btn", src:getNegImage(), cb:()=>{
msg.new = false; saveMessages(); msg.new = false; saveMessages();
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
@ -248,7 +275,7 @@ function showMessage(msgid) {
var body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n"); var body = (lines.length>4) ? lines.slice(0,4).join("\n")+"..." : lines.join("\n");
layout = new Layout({ type:"v", c: [ layout = new Layout({ type:"v", c: [
{type:"h", fillx:1, bgCol:colBg, c: [ {type:"h", fillx:1, bgCol:colBg, c: [
{ type:"btn", src:getMessageImage(msg), pad: 3, cb:()=>{ { type:"btn", src:getMessageImage(msg), col:getMessageImageCol(msg), pad: 3, cb:()=>{
cancelReloadTimeout(); // don't auto-reload to clock now cancelReloadTimeout(); // don't auto-reload to clock now
showMessageSettings(msg); showMessageSettings(msg);
}}, }},
@ -310,7 +337,9 @@ function checkMessages(options) {
body = msg.track; body = msg.track;
} }
if (img) { if (img) {
g.drawImage(img, x+24, r.y+24, {rotate:0}); // force centering var fg = g.getColor();
g.setColor(getMessageImageCol(msg,fg)).drawImage(img, x+24, r.y+24, {rotate:0}) // force centering
.setColor(fg); // only color the icon
x += 50; x += 50;
} }
var m = msg.title+"\n"+msg.body; var m = msg.title+"\n"+msg.body;