s/showMsgIfUnread/ignoreUnread/

master
Rob Pilling 2024-11-07 17:40:23 +00:00
parent f5b3ad2810
commit 6c42d015e7
2 changed files with 11 additions and 11 deletions

View File

@ -155,7 +155,7 @@ function showMapMessage(msg) {
function back() { // mark as not new and return to menu function back() { // mark as not new and return to menu
msg.new = false; msg.new = false;
layout = undefined; layout = undefined;
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:settings.showMsgIfUnread,openMusic:0}); checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:settings.ignoreUnread,openMusic:0});
} }
Bangle.setUI({mode:"updown", back: back}, back); // any input takes us back Bangle.setUI({mode:"updown", back: back}, back); // any input takes us back
} }
@ -195,7 +195,7 @@ function showMusicMessage(msg) {
var wasNew = msg.new; var wasNew = msg.new;
msg.new = false; msg.new = false;
layout = undefined; layout = undefined;
if (wasNew) checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:0,openMusic:0}); if (wasNew) checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:1,openMusic:0});
else returnToMain(); else returnToMain();
} }
function updateLabels() { function updateLabels() {
@ -476,7 +476,7 @@ function showMessage(msgid, persist) {
/* options = { /* options = {
clockIfNoMsg : bool clockIfNoMsg : bool
clockIfAllRead : bool clockIfAllRead : bool
showMsgIfUnread : bool ignoreUnread : bool // don't automatically navigate to the first unread message
openMusic : bool // open music if it's playing openMusic : bool // open music if it's playing
dontStopBuzz : bool // don't stuf buzzing (any time other than the first this is undefined/false) 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 // we have >0 messages
var newMessages = MESSAGES.filter(m=>m.new&&m.id!="music"); var newMessages = MESSAGES.filter(m=>m.new&&m.id!="music");
// If we have a new message, show it // 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 delete newMessages[0].show; // stop us getting stuck here if we're called a second time
showMessage(newMessages[0].id, false); showMessage(newMessages[0].id, false);
// buzz after showMessage, so being busy during layout doesn't affect the buzz pattern // buzz after showMessage, so being busy during layout doesn't affect the buzz pattern
@ -571,15 +571,15 @@ function checkMessages(options) {
} }
function returnToCheckMessages(clock) { function returnToCheckMessages(clock) {
checkMessages({clockIfNoMsg:1,clockIfAllRead:1,showMsgIfUnread:settings.showMsgIfUnread,openMusic}); checkMessages({clockIfNoMsg:1,clockIfAllRead:1,ignoreUnread:settings.ignoreUnread,openMusic});
} }
function returnToMain() { function returnToMain() {
checkMessages({clockIfNoMsg:0,clockIfAllRead:0,showMsgIfUnread:0,openMusic:0}); checkMessages({clockIfNoMsg:0,clockIfAllRead:0,ignoreUnread:1,openMusic:0});
} }
function returnToClockIfEmpty() { function returnToClockIfEmpty() {
checkMessages({clockIfNoMsg:1,clockIfAllRead:0,showMsgIfUnread:0,openMusic}); checkMessages({clockIfNoMsg:1,clockIfAllRead:0,ignoreUnread:1,openMusic});
} }
function cancelReloadTimeout() { function cancelReloadTimeout() {
@ -605,7 +605,7 @@ setTimeout(() => {
// only openMusic on launch if music is new, or state=="show" (set by messagesmusic) // only openMusic on launch if music is new, or state=="show" (set by messagesmusic)
var musicMsg = MESSAGES.find(m => m.id === "music"); var musicMsg = MESSAGES.find(m => m.id === "music");
checkMessages({ checkMessages({
clockIfNoMsg: 0, clockIfAllRead: 0, showMsgIfUnread: settings.showMsgIfUnread, clockIfNoMsg: 0, clockIfAllRead: 0, ignoreUnread: settings.ignoreUnread,
openMusic: ((musicMsg&&musicMsg.new) && settings.openMusic) || (musicMsg&&musicMsg.state=="show"), openMusic: ((musicMsg&&musicMsg.new) && settings.openMusic) || (musicMsg&&musicMsg.state=="show"),
dontStopBuzz: 1 }); dontStopBuzz: 1 });
}, 10); // if checkMessages wants to 'load', do that }, 10); // if checkMessages wants to 'load', do that

View File

@ -11,7 +11,7 @@
if (settings.unreadTimeout===undefined) settings.unreadTimeout=60; if (settings.unreadTimeout===undefined) settings.unreadTimeout=60;
if (settings.maxMessages===undefined) settings.maxMessages=3; if (settings.maxMessages===undefined) settings.maxMessages=3;
if (settings.iconColorMode === undefined) settings.iconColorMode = iconColorModes[0]; if (settings.iconColorMode === undefined) settings.iconColorMode = iconColorModes[0];
if (settings.showMsgIfUnread === undefined) settings.showMsgIfUnread = 1; if (settings.ignoreUnread === undefined) settings.ignoreUnread = 0;
settings.unlockWatch=!!settings.unlockWatch; settings.unlockWatch=!!settings.unlockWatch;
settings.openMusic=!!settings.openMusic; settings.openMusic=!!settings.openMusic;
settings.maxUnreadTimeout=240; settings.maxUnreadTimeout=240;
@ -60,8 +60,8 @@
onchange: v => updateSetting("fontSize", v) onchange: v => updateSetting("fontSize", v)
}, },
/*LANG*/'Auto-Open Unread Msg': { /*LANG*/'Auto-Open Unread Msg': {
value: !!settings().showMsgIfUnread, value: !!settings().ignoreUnread,
onchange: v => updateSetting("showMsgIfUnread", v) onchange: v => updateSetting("ignoreUnread", v)
}, },
/*LANG*/'Auto-Open Music': { /*LANG*/'Auto-Open Music': {
value: !!settings().openMusic, value: !!settings().openMusic,