msgwakefup:update to work better with new messagegui update
parent
176c1548a4
commit
23ead9a069
|
|
@ -1 +1,3 @@
|
|||
0.01: New App!
|
||||
0.02: Update to work better with new version of messagegui when fastload utils
|
||||
is also installed.
|
||||
|
|
|
|||
|
|
@ -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});
|
||||
|
||||
// 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:
|
||||
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();
|
||||
}});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
Loading…
Reference in New Issue