Fork sync

This commit is contained in:
SBado
2020-10-28 09:26:37 +01:00
7 changed files with 44 additions and 11 deletions

View File

@@ -11,15 +11,33 @@ export const FullyKioskMixin = (C) => class extends C {
this._fullyMotion = false;
this._motionTimeout = undefined;
for (const event of ["screenOn", "screenOff", "pluggedAC", "pluggedUSB", "onBatteryLevelChanged", "unplugged", "networkReconnect"]) {
fully.bind(event, "window.browser_mod.fully_update();");
for (const ev of ["screenOn", "screenOff", "pluggedAC", "pluggedUSB", "onBatteryLevelChanged", "unplugged", "networkReconnect", "onMotion"]) {
window.fully.bind(ev, `window.browser_mod.fully_update("${ev}");`);
}
window.fully.bind("onMotion", "window.browser_mod.fullyMotionTriggered();");
this._keepingAlive = false;
}
fully_update() {
fully_update(event) {
if(!this.isFully) return
if(event === "screenOn") {
window.clearTimeout(this._keepAliveTimer);
if(!this._keepingAlive)
this.screen_update();
} else if (event === "screenOff") {
this.screen_update();
this._keepingAlive = false;
if(this.config.force_stay_awake) {
this._keepAliveTimer = window.setTimeout(() => {
this._keepingAlive = true;
window.fully.turnScreenOn();
window.fully.turnScreenOff();
}, 270000);
}
} else if (event === "onMotion") {
this.fullyMotionTriggered();
}
this.sendUpdate({fully: {
battery: window.fully.getBatteryLevel(),
charging: window.fully.isPlugged(),

View File

@@ -95,6 +95,7 @@ class BrowserMod extends ext(BrowserModConnection, [
if(msg.camera) {
this.setup_camera();
}
this.config = {...this.config, ...msg};
}
this.player_update();
this.fully_update();

View File

@@ -42,7 +42,7 @@ export const BrowserModPopupsMixin = (C) => class extends C {
const open = () => {
popUp(
cfg.tile,
cfg.title,
cfg.card,
cfg.large,
cfg.style,

View File

@@ -29,10 +29,6 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
`;
document.body.appendChild(this._blackout_panel);
if(this.isFully) {
window.fully.bind("screenOn", "window.browser_mod.screen_update();");
window.fully.bind("screenOff", "window.browser_mod.screen_update();");
}
}
screensaver_set(fn, clearfn, time) {
@@ -92,7 +88,7 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
this.screensaver_set(
() => {
if(this.isFully)
window.fully.turnScreenOff();
window.fully.turnScreenOff(true);
else
this._blackout_panel.style.display = "block";
this.screen_update();
@@ -109,6 +105,8 @@ export const BrowserModScreensaverMixin = (C) => class extends C {
}
no_blackout() {
if(this.isFully)
window.fully.turnScreenOn();
this.screensaver_stop();
}