Skip to content

Commit ca6bc73

Browse files
authored
Merge pull request #3867 from thyttan/face-up-wakes-on-new-message
msgwakefup: update to work better with new messagegui update
2 parents d07eb4b + 23ead9a commit ca6bc73

File tree

3 files changed

+30
-5
lines changed

3 files changed

+30
-5
lines changed

apps/msgwakefup/ChangeLog

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,3 @@
11
0.01: New App!
2+
0.02: Update to work better with new version of messagegui when fastload utils
3+
is also installed.

apps/msgwakefup/boot.js

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,32 @@
1+
{
2+
let attach = ()=>{
3+
if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true});
4+
5+
// Give messagegui some extra time to add its remove function to
6+
// Bangle.uiRemove, then attach msgtwscr remove logic.
7+
setTimeout(
8+
()=>{if (Bangle.uiRemove) {
9+
let showMessageUIRemove = Bangle.uiRemove;
10+
Bangle.uiRemove = function () {
11+
Bangle.setOptions({wakeOnFaceUp:false});
12+
showMessageUIRemove();
13+
attachAfterTimeout();
14+
}
15+
}},
16+
850)
17+
}
18+
19+
let attachAfterTimeout = ()=>{
20+
setTimeout(()=>{
21+
attach();
22+
},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.
23+
}
24+
125
// If doing regular loads, not Bangle.load, this is used:
2-
if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true});
26+
if (global.__FILE__=="messagegui.new.js") attach();
327

428
// If Fastload Utils is installed this is used:
529
Bangle.on("message", (_, msg)=>{if (Bangle.CLOCK && msg.new) {
6-
setTimeout(()=>{
7-
if (global.__FILE__=="messagegui.new.js") Bangle.setOptions({wakeOnFaceUp:true});
8-
},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.
30+
attachAfterTimeout();
931
}});
32+
}

apps/msgwakefup/metadata.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{ "id": "msgwakefup",
22
"name": "Message wake on face up",
3-
"version":"0.01",
3+
"version":"0.02",
44
"description": "Temporarily activate wake on face up function when a new message is auto displayed.",
55
"icon": "app.png",
66
"tags": "messages,tweak",

0 commit comments

Comments
 (0)