Fixes for iOS and FKB

This commit is contained in:
2020-10-24 22:54:08 +02:00
parent d25c2e9767
commit 7d17efd961
9 changed files with 71 additions and 44 deletions

View File

@@ -11,15 +11,20 @@ export const BrowserModBrowserMixin = (C) => class extends C {
}
sensor_update() {
this.sendUpdate({browser: {
path: window.location.pathname,
visibility: document.visibilityState,
userAgent: navigator.userAgent,
currentUser: this._hass &&this._hass.user && this._hass.user.name,
fullyKiosk: this.isFully,
width: window.innerWidth,
height: window.innerHeight,
}});
window.queueMicrotask( async () => {
const battery = navigator.getBattery ? await navigator.getBattery() : undefined;
this.sendUpdate({browser: {
path: window.location.pathname,
visibility: document.visibilityState,
userAgent: navigator.userAgent,
currentUser: this._hass &&this._hass.user && this._hass.user.name,
fullyKiosk: this.isFully,
width: window.innerWidth,
height: window.innerHeight,
battery: this.isFully ? window.fully.getBatteryLevel() : battery ? battery.level*100 : undefined,
charging: this.isFully ? window.fully.isPlugged() : battery ? battery.charging : undefined,
}});
});
}
do_navigate(path) {