|
|
|
@ -155,7 +155,7 @@ function showMapMessage(msg) {
|
|
|
|
|
function back() { // mark as not new and return to menu
|
|
|
|
|
msg.new = false;
|
|
|
|
|
layout = undefined;
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:0});
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:settings.ignoreUnread,openMusic:0});
|
|
|
|
|
}
|
|
|
|
|
Bangle.setUI({mode:"updown", back: back}, back); // any input takes us back
|
|
|
|
|
}
|
|
|
|
@ -195,8 +195,8 @@ function showMusicMessage(msg) {
|
|
|
|
|
var wasNew = msg.new;
|
|
|
|
|
msg.new = false;
|
|
|
|
|
layout = undefined;
|
|
|
|
|
if (wasNew) checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
else checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
if (wasNew) checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:1,openMusic:0});
|
|
|
|
|
else returnToMain();
|
|
|
|
|
}
|
|
|
|
|
function updateLabels() {
|
|
|
|
|
trackName = reduceStringAndPad(msg.track, trackScrollOffset, 13);
|
|
|
|
@ -304,7 +304,7 @@ function showMessageSettings(msg) {
|
|
|
|
|
menu = Object.assign(menu, {
|
|
|
|
|
/*LANG*/"Delete" : () => {
|
|
|
|
|
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
returnToMain();
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -315,25 +315,25 @@ function showMessageSettings(msg) {
|
|
|
|
|
Bangle.messageIgnore(msg);
|
|
|
|
|
MESSAGES = MESSAGES.filter(m=>m.id!=msg.id);
|
|
|
|
|
}
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
returnToMain();
|
|
|
|
|
});
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
menu = Object.assign(menu, {
|
|
|
|
|
/*LANG*/"Mark Unread" : () => {
|
|
|
|
|
msg.new = true;
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
returnToMain();
|
|
|
|
|
},
|
|
|
|
|
/*LANG*/"Mark all read" : () => {
|
|
|
|
|
MESSAGES.forEach(msg => msg.new = false);
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
returnToMain();
|
|
|
|
|
},
|
|
|
|
|
/*LANG*/"Delete all messages" : () => {
|
|
|
|
|
E.showPrompt(/*LANG*/"Are you sure?", {title:/*LANG*/"Delete All Messages"}).then(isYes => {
|
|
|
|
|
if (isYes) {
|
|
|
|
|
MESSAGES = [];
|
|
|
|
|
}
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0});
|
|
|
|
|
returnToMain();
|
|
|
|
|
});
|
|
|
|
|
},
|
|
|
|
|
});
|
|
|
|
@ -349,7 +349,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
clearInterval(updateLabelsInterval);
|
|
|
|
|
updateLabelsInterval=undefined;
|
|
|
|
|
}
|
|
|
|
|
if (!msg) return checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic:openMusic}); // go home if no message found
|
|
|
|
|
if (!msg) return returnToClockIfEmpty(); // go home if no message found
|
|
|
|
|
if (msg.id=="music") {
|
|
|
|
|
cancelReloadTimeout(); // don't auto-reload to clock now
|
|
|
|
|
return showMusicMessage(msg);
|
|
|
|
@ -399,7 +399,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
layout = undefined;
|
|
|
|
|
msg.new = false; // read mail
|
|
|
|
|
cancelReloadTimeout(); // don't auto-reload to clock now
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic:openMusic});
|
|
|
|
|
returnToClockIfEmpty();
|
|
|
|
|
}
|
|
|
|
|
var negHandler,posHandler,footer = [ ];
|
|
|
|
|
if (msg.negative) {
|
|
|
|
@ -407,7 +407,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
msg.new = false;
|
|
|
|
|
cancelReloadTimeout(); // don't auto-reload to clock now
|
|
|
|
|
Bangle.messageResponse(msg,false);
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
|
|
|
|
|
returnToCheckMessages();
|
|
|
|
|
}; footer.push({type:"img",src:atob("PhAB4A8AAAAAAAPAfAMAAAAAD4PwHAAAAAA/H4DwAAAAAH78B8AAAAAA/+A/AAAAAAH/Af//////w/gP//////8P4D///////H/Af//////z/4D8AAAAAB+/AfAAAAAA/H4DwAAAAAPg/AcAAAAADwHwDAAAAAA4A8AAAAAAAA=="),col:"#f00",cb:negHandler});
|
|
|
|
|
}
|
|
|
|
|
footer.push({fillx:1}); // push images to left/right
|
|
|
|
@ -421,7 +421,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
Bluetooth.println(JSON.stringify(result));
|
|
|
|
|
replying = false;
|
|
|
|
|
layout.render();
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
|
|
|
|
|
returnToCheckMessages();
|
|
|
|
|
})
|
|
|
|
|
.catch(() => {
|
|
|
|
|
replying = false;
|
|
|
|
@ -435,7 +435,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
msg.new = false;
|
|
|
|
|
cancelReloadTimeout(); // don't auto-reload to clock now
|
|
|
|
|
Bangle.messageResponse(msg,true);
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:1,openMusic:openMusic});
|
|
|
|
|
returnToCheckMessages();
|
|
|
|
|
}; footer.push({type:"img",src:atob("QRABAAAAAAAAAAOAAAAABgAAA8AAAAADgAAD4AAAAAHgAAPgAAAAAPgAA+AAAAAAfgAD4///////gAPh///////gA+D///////AD4H//////8cPgAAAAAAPw8+AAAAAAAfB/4AAAAAAA8B/gAAAAAABwB+AAAAAAADAB4AAAAAAAAABgAA=="),col:"#0f0",cb:posHandler});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -447,7 +447,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
]},
|
|
|
|
|
{ type:"btn",
|
|
|
|
|
src:require("messageicons").getImage(msg),
|
|
|
|
|
col:require("messageicons").getColor(msg, {settings:settings, default:g.theme.fg2}),
|
|
|
|
|
col:require("messageicons").getColor(msg, {settings, default:g.theme.fg2}),
|
|
|
|
|
pad: 3, cb:()=>{
|
|
|
|
|
cancelReloadTimeout(); // don't auto-reload to clock now
|
|
|
|
|
showMessageSettings(msg);
|
|
|
|
@ -476,7 +476,7 @@ function showMessage(msgid, persist) {
|
|
|
|
|
/* options = {
|
|
|
|
|
clockIfNoMsg : bool
|
|
|
|
|
clockIfAllRead : bool
|
|
|
|
|
showMsgIfUnread : bool
|
|
|
|
|
ignoreUnread : bool // don't automatically navigate to the first unread message
|
|
|
|
|
openMusic : bool // open music if it's playing
|
|
|
|
|
dontStopBuzz : bool // don't stuf buzzing (any time other than the first this is undefined/false)
|
|
|
|
|
}
|
|
|
|
@ -500,7 +500,7 @@ function checkMessages(options) {
|
|
|
|
|
// we have >0 messages
|
|
|
|
|
var newMessages = MESSAGES.filter(m=>m.new&&m.id!="music");
|
|
|
|
|
// If we have a new message, show it
|
|
|
|
|
if (options.showMsgIfUnread && newMessages.length) {
|
|
|
|
|
if (!options.ignoreUnread && newMessages.length) {
|
|
|
|
|
delete newMessages[0].show; // stop us getting stuck here if we're called a second time
|
|
|
|
|
showMessage(newMessages[0].id, false);
|
|
|
|
|
// buzz after showMessage, so being busy during layout doesn't affect the buzz pattern
|
|
|
|
@ -538,7 +538,7 @@ function checkMessages(options) {
|
|
|
|
|
}
|
|
|
|
|
if (img) {
|
|
|
|
|
var fg = g.getColor(),
|
|
|
|
|
col = require("messageicons").getColor(msg, {settings:settings, default:fg});
|
|
|
|
|
col = require("messageicons").getColor(msg, {settings, default:fg});
|
|
|
|
|
g.setColor(col).drawImage(img, x+24, r.y+24, {rotate:0}) // force centering
|
|
|
|
|
.setColor(fg); // only color the icon
|
|
|
|
|
x += 50;
|
|
|
|
@ -570,6 +570,17 @@ function checkMessages(options) {
|
|
|
|
|
});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function returnToCheckMessages(clock) {
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:settings.ignoreUnread,openMusic});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function returnToMain() {
|
|
|
|
|
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,ignoreUnread:1,openMusic:0});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function returnToClockIfEmpty() {
|
|
|
|
|
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,ignoreUnread:1,openMusic});
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function cancelReloadTimeout() {
|
|
|
|
|
if (!unreadTimeout) return;
|
|
|
|
@ -594,7 +605,7 @@ setTimeout(() => {
|
|
|
|
|
// only openMusic on launch if music is new, or state=="show" (set by messagesmusic)
|
|
|
|
|
var musicMsg = MESSAGES.find(m => m.id === "music");
|
|
|
|
|
checkMessages({
|
|
|
|
|
clockIfNoMsg: 0, clockIfAllRead: 0, showMsgIfUnread: 1,
|
|
|
|
|
clockIfNoMsg: 0, clockIfAllRead: 0, ignoreUnread: settings.ignoreUnread,
|
|
|
|
|
openMusic: ((musicMsg&&musicMsg.new) && settings.openMusic) || (musicMsg&&musicMsg.state=="show"),
|
|
|
|
|
dontStopBuzz: 1 });
|
|
|
|
|
}, 10); // if checkMessages wants to 'load', do that
|
|
|
|
|