Merge pull request #3867 from thyttan/face-up-wakes-on-new-message

msgwakefup: update to work better with new messagegui update
master
Rob Pilling 2025-06-03 22:02:48 +01:00 committed by GitHub
commit ca6bc73090
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 30 additions and 5 deletions

View File

@ -1 +1,3 @@
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 @@
{
let attach = ()=>{
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") Bangle.setOptions({wakeOnFaceUp:true});
if (global.__FILE__=="messagegui.new.js") attach();
// If Fastload Utils is installed this is used:
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
setTimeout(()=>{
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.
attachAfterTimeout();
}});
}

View File

@ -1,6 +1,6 @@
{ "id": "msgwakefup",
"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.",
"icon": "app.png",
"tags": "messages,tweak",