Add support for folders in Watch app#4376
Conversation
There was a problem hiding this comment.
Pull request overview
This pull request adds folder support to the Home Assistant Watch app, allowing users to organize their watch items into collapsible folders for better navigation. This addresses issue #1422 which requested folder organization for the watch app.
Changes:
- Adds a new
foldertype toMagicItem.ItemTypewith nested items support via theitemsproperty - Implements iOS UI for creating, editing, and managing folders in the Watch configuration view
- Implements watchOS UI for navigating into folders and displaying folder contents
- Updates the communication service to properly handle folder items and their children
- Adds comprehensive unit tests for folder management functionality
Reviewed changes
Copilot reviewed 13 out of 15 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| Sources/Shared/MagicItem/MagicItem.swift | Adds folder type and items property to support nested folder structure |
| Sources/Shared/MagicItem/MagicItemProvider.swift | Adds folder info provider with folder icon and default name |
| Sources/App/Settings/AppleWatch/HomeCustomization/WatchConfigurationViewModel.swift | Implements folder management methods (add, update, delete, move items) |
| Sources/App/Settings/AppleWatch/HomeCustomization/WatchConfigurationView.swift | Adds UI for creating folders with name input sheet |
| Sources/App/Settings/AppleWatch/HomeCustomization/FolderDetailView.swift | Implements folder content editing view with item management |
| Sources/App/Settings/AppleWatch/HomeCustomization/FolderEditView.swift | Implements folder customization view for icon, colors, and name |
| Sources/Extensions/Watch/Home/WatchHomeView.swift | Adds folder navigation with back button and folder row display |
| Sources/Extensions/Watch/Home/MagicItemRow/WatchFolderRow.swift | Implements Watch folder row UI component with chevron indicator |
| Sources/Extensions/Watch/Home/MagicItemRow/WatchMagicViewRow.swift | Refactors icon color handling for consistency |
| Sources/Watch/WatchCommunicatorService.swift | Updates to send folder and nested item info to Watch, handles folder press events |
| Tests/App/Watch/WatchConfig.test.swift | Adds comprehensive unit tests for folder operations |
| FolderDetailView.swift | Duplicate file in project root (should be removed) |
| HomeAssistant.xcworkspace/contents.xcworkspacedata | Adds workspace file reference (likely unintended) |
| Podfile.lock | Updates HAKit checksum and CocoaPods version (likely unintended) |
| HomeAssistant.xcodeproj/project.pbxproj | Adds new files to Xcode project |
Files not reviewed (1)
- HomeAssistant.xcworkspace/contents.xcworkspacedata: Language not supported
Comments suppressed due to low confidence (2)
FolderDetailView.swift:64
- The project uses SFSafeSymbols for type-safe SF Symbol references. Use systemSymbol parameter instead of systemName with string literals to comply with the coding guidelines and avoid runtime errors from invalid symbol names.
Image(systemName: "line.3.horizontal")
FolderDetailView.swift:77
- The project uses SFSafeSymbols for type-safe SF Symbol references. Use systemSymbol parameter instead of systemName with string literals to comply with the coding guidelines and avoid runtime errors from invalid symbol names.
Image(systemName: "line.3.horizontal")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Looking good! I'll be able to review it on Monday, meanwhile feel free to evaluate Copilots comments and address if necessary. |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…nto watch-folders
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 14 out of 15 changed files in this pull request and generated 8 comments.
Comments suppressed due to low confidence (1)
Sources/App/Settings/AppleWatch/HomeCustomization/WatchConfigurationView.swift:257
- This passes a hard-coded fallback folder name ("Folder"). Prefer
L10n.Watch.Configuration.Folder.defaultNamefor localization consistency. Also, consider not passingfolderNameas a separate constant—after editing a folder name inFolderEditView,FolderDetailView’s navigation title won’t update because it uses this captured value.
NavigationLink {
FolderDetailView(
folderId: item.id,
folderName: item.displayText ?? "Folder",
viewModel: viewModel
)
…ew.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rationView.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
…rationView.swift Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
|
Converting to draft while I fix a bug I found. |
|
Looking forward to use it on my watch! For some reason I cannot push to your branch anymore, so just fix the linting issues and let's merge it :D |
|
@bgoncal lints fixed! |
|
@bgoncal no worries! Fixed, I think. |
|
@joelhawksley I will have to revert your PR, I just noticed that between the massive changes in the .pbxproj file, you set to "auto sign", and this is not correct and also breaks the CI. Can you revert the changes for this file and then add just what you need (files etc)? |
|
#4396 here you go! |
Summary
It's pretty unwieldy to navigate a long list of items in the current Watch app. By adding the ability to group items into folders, you can now create a mini dashboard of sorts that is significantly easier to use.
For full disclosure, this was my first time writing Swift and otherwise working with Xcode. I had a lot of help from Claude Opus but did what I could to self-review and test.
Screenshots
demo.mov
Link to pull request in Documentation repository
TODO: I will write docs assuming the UI flow is approved.
Any other notes
Related issue: #1422