mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-31 05:06:38 +00:00
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
4
src/data/external.ts
Normal file
4
src/data/external.ts
Normal file
@ -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";
|
} from "home-assistant-js-websocket";
|
||||||
|
|
||||||
import { loadTokens, saveTokens } from "../common/auth/token_storage";
|
import { loadTokens, saveTokens } from "../common/auth/token_storage";
|
||||||
|
import { isExternal } from "../data/external";
|
||||||
import { subscribePanels } from "../data/ws-panels";
|
import { subscribePanels } from "../data/ws-panels";
|
||||||
import { subscribeThemes } from "../data/ws-themes";
|
import { subscribeThemes } from "../data/ws-themes";
|
||||||
import { subscribeUser } from "../data/ws-user";
|
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
|
const authProm = isExternal
|
||||||
? () =>
|
? () =>
|
||||||
import(
|
import(
|
||||||
|
@ -31,6 +31,7 @@ import {
|
|||||||
getOptimisticFrontendUserDataCollection,
|
getOptimisticFrontendUserDataCollection,
|
||||||
CoreFrontendUserData,
|
CoreFrontendUserData,
|
||||||
} from "../../data/frontend";
|
} from "../../data/frontend";
|
||||||
|
import { isExternal } from "../../data/external";
|
||||||
import { haStyle } from "../../resources/styles";
|
import { haStyle } from "../../resources/styles";
|
||||||
import { HomeAssistant } from "../../types";
|
import { HomeAssistant } from "../../types";
|
||||||
import { fireEvent } from "../../common/dom/fire_event";
|
import { fireEvent } from "../../common/dom/fire_event";
|
||||||
@ -113,10 +114,14 @@ class HaPanelProfile extends LitElement {
|
|||||||
></ha-set-vibrate-row>
|
></ha-set-vibrate-row>
|
||||||
`
|
`
|
||||||
: ""}
|
: ""}
|
||||||
<ha-push-notifications-row
|
${!isExternal
|
||||||
.narrow=${this.narrow}
|
? html`
|
||||||
.hass=${this.hass}
|
<ha-push-notifications-row
|
||||||
></ha-push-notifications-row>
|
.narrow=${this.narrow}
|
||||||
|
.hass=${this.hass}
|
||||||
|
></ha-push-notifications-row>
|
||||||
|
`
|
||||||
|
: ""}
|
||||||
${this.hass.user!.is_admin
|
${this.hass.user!.is_admin
|
||||||
? html`
|
? html`
|
||||||
<ha-advanced-mode-row
|
<ha-advanced-mode-row
|
||||||
|
Loading…
x
Reference in New Issue
Block a user