ref: use display status callback
This commit is contained in:
+2
-1
@@ -112,8 +112,9 @@ const init = async () => {
|
||||
});
|
||||
|
||||
// Check for display changes
|
||||
setDisplayStatus("ON", () => {
|
||||
interval(update, 1000);
|
||||
setDisplayStatus("ON");
|
||||
});
|
||||
|
||||
return true;
|
||||
};
|
||||
|
||||
+13
-5
@@ -206,7 +206,7 @@ const initApp = () => {
|
||||
.on("message", (topic, message) => {
|
||||
if (topic === config.command_topic) {
|
||||
console.log("Update App...");
|
||||
hardware.setDisplayStatus("ON");
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
const args = ["-c", `bash <(wget -qO- ${APP.scripts.install}) update`];
|
||||
hardware.execScriptCommand("bash", args, (progress, error) => {
|
||||
if (progress) {
|
||||
@@ -214,6 +214,7 @@ const initApp = () => {
|
||||
}
|
||||
updateApp(progress);
|
||||
});
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
@@ -259,8 +260,9 @@ const initShutdown = () => {
|
||||
.on("message", (topic, message) => {
|
||||
if (topic === config.command_topic) {
|
||||
console.log("Shutdown system...");
|
||||
hardware.setDisplayStatus("ON");
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
hardware.shutdownSystem();
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
@@ -285,8 +287,9 @@ const initReboot = () => {
|
||||
.on("message", (topic, message) => {
|
||||
if (topic === config.command_topic) {
|
||||
console.log("Rebooting system...");
|
||||
hardware.setDisplayStatus("ON");
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
hardware.rebootSystem();
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
@@ -308,8 +311,9 @@ const initRefresh = () => {
|
||||
.on("message", (topic, message) => {
|
||||
if (topic === config.command_topic) {
|
||||
console.log("Refreshing webview...");
|
||||
hardware.setDisplayStatus("ON");
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
EVENTS.emit("reloadView");
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
@@ -335,6 +339,7 @@ const initKiosk = () => {
|
||||
if (topic === config.command_topic) {
|
||||
const status = message.toString();
|
||||
console.log("Set Kiosk Status:", status);
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
switch (status) {
|
||||
case "Framed":
|
||||
WEBVIEW.window.restore();
|
||||
@@ -359,6 +364,7 @@ const initKiosk = () => {
|
||||
case "Terminated":
|
||||
app.quit();
|
||||
}
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
@@ -455,7 +461,7 @@ const initKeyboard = () => {
|
||||
if (topic === config.command_topic) {
|
||||
const status = message.toString();
|
||||
console.log("Set Keyboard Visibility:", status);
|
||||
hardware.setKeyboardVisibility(status);
|
||||
hardware.setDisplayStatus("ON", () => {
|
||||
switch (status) {
|
||||
case "OFF":
|
||||
WEBVIEW.window.restore();
|
||||
@@ -468,6 +474,8 @@ const initKeyboard = () => {
|
||||
WEBVIEW.window.maximize();
|
||||
break;
|
||||
}
|
||||
hardware.setKeyboardVisibility(status);
|
||||
});
|
||||
}
|
||||
})
|
||||
.subscribe(config.command_topic);
|
||||
|
||||
Reference in New Issue
Block a user