Compare commits

...

2 Commits

Author SHA1 Message Date
Maarten Lakerveld 58ded99773 Onboarding survey (#53236)
Use new OHF shortlink service
2026-07-22 12:26:54 +02:00
Timothy 0d2b99b3a5 Disable LaunchScreen for mobile (#53171)
* Disable LaunchScreen for mobile

* Apply suggestions
2026-07-22 12:36:41 +03:00
6 changed files with 34 additions and 9 deletions
+2 -1
View File
@@ -124,7 +124,7 @@ interface EMOutgoingMessageConnectionStatus extends EMMessage {
}
interface EMOutgoingMessageFrontendLoaded extends EMMessage {
type: "frontend/loaded"; // Fired once the launch screen is removed (connected and essential data loaded)
type: "frontend/loaded"; // Fired once the launch screen is removed; with hasSplashscreen this is after the first panel has rendered
}
interface EMOutgoingMessageAppConfiguration extends EMMessage {
@@ -371,6 +371,7 @@ export interface ExternalConfig {
appVersion?: string;
hasEntityAddTo?: boolean; // Supports "Add to" from more-info dialog, with action coming from external app
hasAssistSettings?: boolean; // Shows the "This device" section in voice assistant settings
hasSplashscreen?: boolean; // App covers the frontend with its own loading screen until frontend/loaded, so the launch screen is removed without animation
}
export interface ExternalEntityAddToAction {
+6 -1
View File
@@ -133,7 +133,12 @@ export class HomeAssistantAppEl extends QuickBarMixin(HassElement) {
) {
this.render = this.renderHass;
this.update = super.update;
removeLaunchScreen();
// Apps with a native splash screen keep covering the frontend until
// frontend/loaded, so the launch screen stays up (invisibly) until the
// first panel has rendered and partial-panel-resolver removes it.
if (!this.hass.auth.external?.config.hasSplashscreen) {
removeLaunchScreen();
}
this.hass.auth.external?.fireMessage({ type: "frontend/loaded" });
}
super.update(changedProps);
+2 -1
View File
@@ -220,7 +220,8 @@ class PartialPanelResolver extends HassRouterPage {
) {
await this.rebuild();
await this.pageRendered;
removeLaunchScreen();
removeLaunchScreen(!!this.hass.auth.external?.config.hasSplashscreen);
this.hass.auth.external?.fireMessage({ type: "frontend/loaded" });
}
}
}
+21 -3
View File
@@ -3,10 +3,27 @@ import { render } from "lit";
import { parseAnimationDuration } from "../common/util/parse-animation-duration";
import { withViewTransition } from "../common/util/view-transition";
export const removeLaunchScreen = () => {
let removalInitiated = false;
/**
* Removes the launch screen with a fade-out view transition.
*
* @param instant - Removes the launch screen without animation. Used when the
* external app covers the frontend with its own splash screen until the
* `frontend/loaded` event, where the animation would play invisibly underneath.
* @returns Whether this call initiated the removal (false when the removal
* was already initiated, e.g. while the fade-out is still running).
*/
export const removeLaunchScreen = (instant = false): boolean => {
const launchScreenElement = document.getElementById("ha-launch-screen");
if (!launchScreenElement?.parentElement) {
return;
if (removalInitiated || !launchScreenElement?.parentElement) {
return false;
}
removalInitiated = true;
if (instant) {
launchScreenElement.parentElement.removeChild(launchScreenElement);
return true;
}
withViewTransition((viewTransitionAvailable: boolean) => {
@@ -25,6 +42,7 @@ export const removeLaunchScreen = () => {
launchScreenElement.parentElement?.removeChild(launchScreenElement);
}, parseAnimationDuration(durationFromCss));
});
return true;
};
export const renderLaunchScreenInfoBox = (content: TemplateResult) => {
+1 -1
View File
@@ -14,7 +14,7 @@ const SURVEY_MAX_AGE = 30 * 24 * 60 * 60 * 1000; // 1 month
// version-specific (the version is passed as a query parameter instead), so
// beta/dev installs should not be routed to rc./next. like documentationUrl
// would.
const SURVEY_URL = "https://www.home-assistant.io/surveys/onboarding";
const SURVEY_URL = "https://ohf.to/ha/surveys/onboarding";
export const shouldShowOnboardingSurvey = (
user: CurrentUser | undefined,
+2 -2
View File
@@ -175,14 +175,14 @@ describe("getOnboardingSurveyUrl", () => {
onboarded_version: "2026.7.0",
onboarded_date: "2026-07-14T12:00:00.000Z",
}),
"https://www.home-assistant.io/surveys/onboarding?version=2026.7.0"
"https://ohf.to/ha/surveys/onboarding?version=2026.7.0"
);
});
it("omits a missing version param", () => {
assert.strictEqual(
getOnboardingSurveyUrl({}),
"https://www.home-assistant.io/surveys/onboarding"
"https://ohf.to/ha/surveys/onboarding"
);
});
});