Hide HTML5 push notification toggle if inside external app (#4860)
* Hide HTML5 push notification toggle if external bus is engaged * Use isExternal instead * Hide the whole row * Black * Fix import Co-authored-by: Paulus Schoutsen <paulus@home-assistant.io>
This commit is contained in:
parent
b7a84cdd60
commit
ecc6fcf862
|
@ -0,0 +1,4 @@
|
|||
export const isExternal =
|
||||
window.externalApp ||
|
||||
window.webkit?.messageHandlers?.getExternalAuth ||
|
||||
location.search.includes("external_auth=1");
|
|
@ -10,6 +10,7 @@ import {
|
|||
} from "home-assistant-js-websocket";
|
||||
|
||||
import { loadTokens, saveTokens } from "../common/auth/token_storage";
|
||||
import { isExternal } from "../data/external";
|
||||
import { subscribePanels } from "../data/ws-panels";
|
||||
import { subscribeThemes } from "../data/ws-themes";
|
||||
import { subscribeUser } from "../data/ws-user";
|
||||
|
@ -23,11 +24,6 @@ declare global {
|
|||
}
|
||||
}
|
||||
|
||||
const isExternal =
|
||||
window.externalApp ||
|
||||
window.webkit?.messageHandlers?.getExternalAuth ||
|
||||
location.search.includes("external_auth=1");
|
||||
|
||||
const authProm = isExternal
|
||||
? () =>
|
||||
import(
|
||||
|
|
|
@ -31,6 +31,7 @@ import {
|
|||
getOptimisticFrontendUserDataCollection,
|
||||
CoreFrontendUserData,
|
||||
} from "../../data/frontend";
|
||||
import { isExternal } from "../../data/external";
|
||||
import { haStyle } from "../../resources/styles";
|
||||
import { HomeAssistant } from "../../types";
|
||||
import { fireEvent } from "../../common/dom/fire_event";
|
||||
|
@ -113,10 +114,14 @@ class HaPanelProfile extends LitElement {
|
|||
></ha-set-vibrate-row>
|
||||
`
|
||||
: ""}
|
||||
<ha-push-notifications-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-push-notifications-row>
|
||||
${!isExternal
|
||||
? html`
|
||||
<ha-push-notifications-row
|
||||
.narrow=${this.narrow}
|
||||
.hass=${this.hass}
|
||||
></ha-push-notifications-row>
|
||||
`
|
||||
: ""}
|
||||
${this.hass.user!.is_admin
|
||||
? html`
|
||||
<ha-advanced-mode-row
|
||||
|
|
Loading…
Reference in New Issue