Centralize app domains; adjust widget and intent#4428
Conversation
There was a problem hiding this comment.
Pull request overview
This PR centralizes the list of Home Assistant domains used throughout the app by introducing HAAppUsedContent as a single source of truth. Previously, AppEntitiesModel maintained its own local domain list for entity filtering. Now, this list is shared, and both entity filtering and widget availability checks use it. Additionally, the default widget interaction type for unrecognized domains is updated from a no-op refresh intent to a navigate intent that opens the entity's detail/more-info deeplink.
Changes:
- Introduces
HAAppUsedContentenum with a staticdomainslist andrawValuescomputed property, replacing the localdomainsAppUseprivate list inAppEntitiesModel. - Updates
EntityAddToHandlerto gate theCustomWidgetActionbehind a domain check usingHAAppUsedContent.domains, so unsupported domains no longer offer the widget option. - Changes
MagicItem.widgetInteractionType'sdefaultbranch from.appIntent(.refresh)to a navigate intent (navigateIntent(url:)) pointing to the entity's deeplink.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
Sources/Shared/API/Models/AppEntitiesModel.swift |
Introduces HAAppUsedContent public enum with centralized domain list; replaces local domainsAppUse with HAAppUsedContent.rawValues |
Sources/App/Frontend/ExternalMessageBus/EntityAddToHandler.swift |
Adds domain check before appending CustomWidgetAction, restricting widget option to HAAppUsedContent.domains |
Sources/Shared/MagicItem/MagicItem.swift |
Changes default widget interaction from .appIntent(.refresh) to a deeplink navigate intent |
Sources/App/Frontend/ExternalMessageBus/EntityAddToHandler.swift
Outdated
Show resolved
Hide resolved
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4428 +/- ##
======================================
Coverage ? 0
======================================
Files ? 0
Lines ? 0
Branches ? 0
======================================
Hits ? 0
Misses ? 0
Partials ? 0 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Summary
Introduce HAAppUsedContent to centralize the list of Home Assistant domains and provide rawValues. Use HAAppUsedContent.rawValues in AppEntitiesModel to filter entities (removing the local domains list). Update EntityAddToHandler to only add CustomWidgetAction when the entity's Domain can be constructed and is included in HAAppUsedContent.domains. Change MagicItem's default interactionType from a refresh app intent to a navigateIntent that opens the entity deep link (AppConstants.openEntityDeeplinkURL). These changes restrict widget availability to supported domains and make default item interactions navigate directly to the entity.
Screenshots
Link to pull request in Documentation repository
Documentation: home-assistant/companion.home-assistant#
Any other notes