Add support for replying to messages to messagegui
parent
d5a995a7f8
commit
b0ffab457d
|
|
@ -106,3 +106,4 @@
|
||||||
0.77: Messages can now use international fonts if they are installed
|
0.77: Messages can now use international fonts if they are installed
|
||||||
0.78: Fix: When user taps on a new message, clear the unread timeout
|
0.78: Fix: When user taps on a new message, clear the unread timeout
|
||||||
0.79: Fix: Reset the unread timeout each time a new message is shown. When the message is read from user input, do not set an unread timeout.
|
0.79: Fix: Reset the unread timeout each time a new message is shown. When the message is read from user input, do not set an unread timeout.
|
||||||
|
0.80: Add ability to reply to messages if a reply library is installed and the message can be replied to
|
||||||
|
|
@ -24,6 +24,7 @@ require("messages").pushMessage({"t":"add","id":"call","src":"Phone","title":"Bo
|
||||||
var Layout = require("Layout");
|
var Layout = require("Layout");
|
||||||
var layout; // global var containing the layout for the currently displayed message
|
var layout; // global var containing the layout for the currently displayed message
|
||||||
var settings = require('Storage').readJSON("messages.settings.json", true) || {};
|
var settings = require('Storage').readJSON("messages.settings.json", true) || {};
|
||||||
|
var reply = require("reply");
|
||||||
var fontSmall = "6x8";
|
var fontSmall = "6x8";
|
||||||
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
|
var fontMedium = g.getFonts().includes("6x15")?"6x15":"6x8:2";
|
||||||
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
|
var fontBig = g.getFonts().includes("12x20")?"12x20":"6x8:2";
|
||||||
|
|
@ -45,6 +46,7 @@ if (Graphics.prototype.setFontIntl) {
|
||||||
|
|
||||||
var active; // active screen (undefined/"list"/"music"/"map"/"message"/"scroller"/"settings")
|
var active; // active screen (undefined/"list"/"music"/"map"/"message"/"scroller"/"settings")
|
||||||
var openMusic = false; // go back to music screen after we handle something else?
|
var openMusic = false; // go back to music screen after we handle something else?
|
||||||
|
var replying = false; // If we're replying to a message, don't interrupt
|
||||||
// hack for 2v10 firmware's lack of ':size' font handling
|
// hack for 2v10 firmware's lack of ':size' font handling
|
||||||
try {
|
try {
|
||||||
g.setFont("6x8:2");
|
g.setFont("6x8:2");
|
||||||
|
|
@ -267,11 +269,27 @@ function showMessageSettings(msg) {
|
||||||
/*LANG*/"View Message" : () => {
|
/*LANG*/"View Message" : () => {
|
||||||
showMessageScroller(msg);
|
showMessageScroller(msg);
|
||||||
},
|
},
|
||||||
|
/*LANG*/"Reply": () => {
|
||||||
|
replying = true;
|
||||||
|
reply.reply({msg: msg})
|
||||||
|
.then(result => {
|
||||||
|
Bluetooth.println(JSON.stringify(result));
|
||||||
|
replying = false;
|
||||||
|
showMessage(msg.id);
|
||||||
|
})
|
||||||
|
.catch(() => {
|
||||||
|
replying = false;
|
||||||
|
showMessage(msg.id);
|
||||||
|
});
|
||||||
|
},
|
||||||
/*LANG*/"Delete" : () => {
|
/*LANG*/"Delete" : () => {
|
||||||
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
||||||
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (!msg.reply || !reply) delete menu[/*LANG*/"Reply"];
|
||||||
|
|
||||||
if (Bangle.messageIgnore && msg.src)
|
if (Bangle.messageIgnore && msg.src)
|
||||||
menu[/*LANG*/"Ignore"] = () => {
|
menu[/*LANG*/"Ignore"] = () => {
|
||||||
E.showPrompt(/*LANG*/"Ignore all messages from "+E.toJS(msg.src)+"?", {title:/*LANG*/"Ignore"}).then(isYes => {
|
E.showPrompt(/*LANG*/"Ignore all messages from "+E.toJS(msg.src)+"?", {title:/*LANG*/"Ignore"}).then(isYes => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue