notify,notifyfs: don't turn on screen during Quiet Mode

master
Richard de Boer 2021-03-20 19:18:39 +01:00
parent 0b76f7848e
commit 6e51c1321d
6 changed files with 16 additions and 9 deletions

View File

@ -80,7 +80,7 @@
"name": "Notifications (default)", "name": "Notifications (default)",
"shortName":"Notifications", "shortName":"Notifications",
"icon": "notify.png", "icon": "notify.png",
"version":"0.07", "version":"0.08",
"description": "A handler for displaying notifications that displays them in a bar at the top of the screen", "description": "A handler for displaying notifications that displays them in a bar at the top of the screen",
"tags": "widget", "tags": "widget",
"type": "notify", "type": "notify",
@ -93,7 +93,7 @@
"name": "Fullscreen Notifications", "name": "Fullscreen Notifications",
"shortName":"Notifications", "shortName":"Notifications",
"icon": "notify.png", "icon": "notify.png",
"version":"0.07", "version":"0.08",
"description": "A handler for displaying notifications that displays them fullscreen. This may not fully restore the screen after on some apps. See `Notifications (default)` for more information about the notifications library.", "description": "A handler for displaying notifications that displays them fullscreen. This may not fully restore the screen after on some apps. See `Notifications (default)` for more information about the notifications library.",
"tags": "widget", "tags": "widget",
"type": "notify", "type": "notify",

View File

@ -4,3 +4,4 @@
0.05: Adjust position of notification src text 0.05: Adjust position of notification src text
0.06: Support background color 0.06: Support background color
0.07: Auto-calculate height, and pad text down even when there's no title (so it stays on-screen) 0.07: Auto-calculate height, and pad text down even when there's no title (so it stays on-screen)
0.08: Don't turn on screen during Quiet Mode

View File

@ -9,7 +9,7 @@ other applications or widgets to display messages.
```JS ```JS
options = { options = {
on : bool, // turn screen on, default true on : bool, // turn screen on, default true (But not if Quiet Mode is enabled)
size : int, // height of notification, default is fit to height (80 max) size : int, // height of notification, default is fit to height (80 max)
title : string, // optional title title : string, // optional title
id // optional notification ID, used with hide() id // optional notification ID, used with hide()

View File

@ -127,7 +127,9 @@ exports.show = function(options) {
options.render({x:x, y:y, w:w, h:h}); options.render({x:x, y:y, w:w, h:h});
} }
if (options.on) Bangle.setLCDPower(1); // light up if (options.on && !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
Bangle.setLCDPower(1); // light up
}
Bangle.setLCDMode(oldMode); // clears cliprect Bangle.setLCDMode(oldMode); // clears cliprect
function anim() { function anim() {

View File

@ -5,3 +5,4 @@
0.05: Fix `g` corruption issue if .hide gets called twice 0.05: Fix `g` corruption issue if .hide gets called twice
0.06: Adjust position of notification src text and notifications without title 0.06: Adjust position of notification src text and notifications without title
0.07: Support background color 0.07: Support background color
0.08: Don't turn on screen during Quiet Mode

View File

@ -90,8 +90,9 @@ exports.show = function(options) {
const area={x:x, y:y, w:w, h:h} const area={x:x, y:y, w:w, h:h}
options.render(area); options.render(area);
} }
if (options.on && !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
if (options.on) Bangle.setLCDPower(1); // light up Bangle.setLCDPower(1); // light up
}
Bangle.on("touch", exports.hide); Bangle.on("touch", exports.hide);
// Create a fake graphics to hide draw attempts // Create a fake graphics to hide draw attempts
oldg = g; oldg = g;
@ -115,9 +116,11 @@ exports.hide = function(options) {
Bangle.removeListener("touch", exports.hide); Bangle.removeListener("touch", exports.hide);
g.clear(); g.clear();
Bangle.drawWidgets(); Bangle.drawWidgets();
// flipping the screen off then on often triggers a redraw - it may not! if (Bangle.isLCDOn() || !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
Bangle.setLCDPower(0); // flipping the screen off then on often triggers a redraw - it may not!
Bangle.setLCDPower(1); Bangle.setLCDPower(0);
Bangle.setLCDPower(1);
}
// hack for E.showMenu/showAlert/showPrompt - can force a redraw by faking next/back // hack for E.showMenu/showAlert/showPrompt - can force a redraw by faking next/back
if (Bangle.btnWatches) { if (Bangle.btnWatches) {
global["\xff"].watches[Bangle.btnWatches[0]].callback(); global["\xff"].watches[Bangle.btnWatches[0]].callback();