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)",
"shortName":"Notifications",
"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",
"tags": "widget",
"type": "notify",
@ -93,7 +93,7 @@
"name": "Fullscreen Notifications",
"shortName":"Notifications",
"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.",
"tags": "widget",
"type": "notify",

View File

@ -4,3 +4,4 @@
0.05: Adjust position of notification src text
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.08: Don't turn on screen during Quiet Mode

View File

@ -9,7 +9,7 @@ other applications or widgets to display messages.
```JS
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)
title : string, // optional title
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});
}
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
function anim() {

View File

@ -5,3 +5,4 @@
0.05: Fix `g` corruption issue if .hide gets called twice
0.06: Adjust position of notification src text and notifications without title
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}
options.render(area);
}
if (options.on) Bangle.setLCDPower(1); // light up
if (options.on && !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
Bangle.setLCDPower(1); // light up
}
Bangle.on("touch", exports.hide);
// Create a fake graphics to hide draw attempts
oldg = g;
@ -115,9 +116,11 @@ exports.hide = function(options) {
Bangle.removeListener("touch", exports.hide);
g.clear();
Bangle.drawWidgets();
if (Bangle.isLCDOn() || !(require('Storage').readJSON('setting.json',1)||{}).quiet) {
// flipping the screen off then on often triggers a redraw - it may not!
Bangle.setLCDPower(0);
Bangle.setLCDPower(1);
}
// hack for E.showMenu/showAlert/showPrompt - can force a redraw by faking next/back
if (Bangle.btnWatches) {
global["\xff"].watches[Bangle.btnWatches[0]].callback();