Use GetEntitiesForDisplayUseCase in ManageControls#7184
Open
TimoPtr wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses #7181 by switching the Control settings screen to use GetEntitiesForDisplayUseCase for entity display metadata (instead of relying on the friendly name attribute), and aligns the UI with other entity pickers by showing entity icons and richer subtitle information.
Changes:
- Replace entity loading in
ManageControlsViewModelwithGetEntitiesForDisplayUseCase, excluding hidden entities and sorting by display name. - Update
ManageControlsViewto renderEntityDisplayItem(icon +subtitle()), removing the old domain-string mapping. - Add Robolectric coverage for hidden-entity exclusion, sorting, and per-server failure behavior.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| app/src/main/kotlin/io/homeassistant/companion/android/settings/controls/ManageControlsViewModel.kt | Switches entity retrieval to GetEntitiesForDisplayUseCase, filters hidden items, sorts by resolved display name. |
| app/src/main/kotlin/io/homeassistant/companion/android/settings/controls/views/ManageControlsView.kt | Displays icons and uses EntityDisplayItem.subtitle() instead of a domain-to-string helper. |
| app/src/main/kotlin/io/homeassistant/companion/android/util/compose/EntityInfo.kt | Removes now-unused getEntityDomainString helper. |
| app/src/test/kotlin/io/homeassistant/companion/android/settings/controls/ManageControlsViewModelTest.kt | Adds tests for filtering/sorting and error handling across multiple servers. |
Comment on lines
+96
to
101
| val displayState = getEntitiesForDisplay(server.id) { it.domain in supportedDomains }.last() | ||
| if (displayState is EntityDisplayState.Loaded) { | ||
| entitiesList[server.id] = displayState.entities | ||
| .filterNot { it.isHidden } | ||
| .sortedWith(compareBy(String.CASE_INSENSITIVE_ORDER) { it.name }) | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR closes #7181 by replacing the usage of friendly name with the
GetEntitiesForDisplayUseCaseinManageControls.I've added the icon of the Entity in the list too, to be like in the other entity pickers.
Checklist
Screenshots
Any other notes
I've hidden the entity marked as hidden.