diff --git a/apps/messagegui/ChangeLog b/apps/messagegui/ChangeLog index 7320d8ec6..bb3ac519e 100644 --- a/apps/messagegui/ChangeLog +++ b/apps/messagegui/ChangeLog @@ -106,3 +106,4 @@ 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.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 \ No newline at end of file diff --git a/apps/messagegui/app.js b/apps/messagegui/app.js index 9172bcad7..663e9a028 100644 --- a/apps/messagegui/app.js +++ b/apps/messagegui/app.js @@ -24,6 +24,7 @@ require("messages").pushMessage({"t":"add","id":"call","src":"Phone","title":"Bo var Layout = require("Layout"); var layout; // global var containing the layout for the currently displayed message var settings = require('Storage').readJSON("messages.settings.json", true) || {}; +var reply = require("reply"); var fontSmall = "6x8"; var fontMedium = g.getFonts().includes("6x15")?"6x15":"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 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 try { g.setFont("6x8:2"); @@ -267,11 +269,27 @@ function showMessageSettings(msg) { /*LANG*/"View Message" : () => { 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" : () => { MESSAGES = MESSAGES.filter(m=>m.id!=msg.id); checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0}); }, }; + + if (!msg.reply || !reply) delete menu[/*LANG*/"Reply"]; + if (Bangle.messageIgnore && msg.src) menu[/*LANG*/"Ignore"] = () => { E.showPrompt(/*LANG*/"Ignore all messages from "+E.toJS(msg.src)+"?", {title:/*LANG*/"Ignore"}).then(isYes => {