msgwakefup:update to work better with new messagegui update

master
thyttan 2025-05-27 01:08:43 +02:00
parent 176c1548a4
commit 23ead9a069
3 changed files with 30 additions and 5 deletions

View File

@ -1 +1,3 @@
0.01: New App! 0.01: New App!
0.02: Update to work better with new version of messagegui when fastload utils
is also installed.

View File

@ -1,9 +1,32 @@
// If doing regular loads, not Bangle.load, this is used: {
let attach = ()=>{
if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true}); if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true});
// Give messagegui some extra time to add its remove function to
// Bangle.uiRemove, then attach msgtwscr remove logic.
setTimeout(
()=>{if (Bangle.uiRemove) {
let showMessageUIRemove = Bangle.uiRemove;
Bangle.uiRemove = function () {
Bangle.setOptions({wakeOnFaceUp:false});
showMessageUIRemove();
attachAfterTimeout();
}
}},
850)
}
let attachAfterTimeout = ()=>{
setTimeout(()=>{
attach();
},700) // It feels like there's a more elegant solution than checking the filename after 700 milliseconds. But this at least seems to work w/o sometimes activating when it shouldn't.
}
// If doing regular loads, not Bangle.load, this is used:
if (global.__FILE__=="messagegui.new.js") attach();
// If Fastload Utils is installed this is used: // If Fastload Utils is installed this is used:
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) { Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
setTimeout(()=>{ attachAfterTimeout();
if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true});
},700) // It feels like there's a more elegant solution than checking the filename after 700 milliseconds. But this at least seems to work w/o sometimes activating when it shouldn't.
}}); }});
}

View File

@ -1,6 +1,6 @@
{ "id": "msgwakefup", { "id": "msgwakefup",
"name": "Message wake on face up", "name": "Message wake on face up",
"version":"0.01", "version":"0.02",
"description": "Temporarily activate wake on face up function when a new message is auto displayed.", "description": "Temporarily activate wake on face up function when a new message is auto displayed.",
"icon": "app.png", "icon": "app.png",
"tags": "messages,tweak", "tags": "messages,tweak",