mirror of
https://github.com/home-assistant/iOS.git
synced 2026-02-04 21:15:17 -06:00
2 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
d79ef4d400
|
Add display text override parameter to Control Center controls (#4104)
## Add display text parameter to Control Center controls - [x] Explore repository structure and understand Control Center controls - [x] Add displayText parameter to ControlButtonConfiguration (Button control) - [x] Update ControlButtonValueProvider to use displayText when available - [x] Add displayText parameter to ControlSwitchConfiguration (Switch control) - [x] Update ControlSwitchValueProvider to use displayText when available - [x] Add displayText parameter to ControlLightsConfiguration (Light control) - [x] Update ControlLightsValueProvider to use displayText when available - [x] Add displayText parameter to ControlCoverConfiguration (Cover control) - [x] Update ControlCoverValueProvider to use displayText when available - [x] Add displayText parameter to ControlSceneConfiguration (Scene control) - [x] Update ControlScenesValueProvider to use displayText when available - [x] Update ControlScene to use displayText in Label - [x] Add displayText parameter to ControlScriptsConfiguration (Script control) - [x] Update ControlScriptsValueProvider to use displayText when available - [x] Update ControlScript to use displayText in Label - [x] Add displayText parameter to ControlOpenPageConfiguration (OpenPage control) - [x] Update ControlOpenPageValueProvider to use displayText when available - [x] Update ControlOpenPage to use displayText in Label - [x] Add displayText parameter to ControlAssistConfiguration (Assist control) - [x] Update ControlAssistValueProvider to use displayText when available - [x] Update ControlAssist to use displayText in Label - [x] Add displayText parameter to all OpenEntity controls (Entity, Switch, Light, Cover, InputBoolean, Lock, Camera, Sensor) - [x] Update all OpenEntity value providers to use displayText when available - [x] Update all OpenEntity controls to use displayText in Labels - [x] Run code review - No issues found - [x] Run security checks - No vulnerabilities detected - [x] Fix SwiftFormat lint issues - wrapped long lines to meet 120 character limit ## Summary Successfully added an optional `displayText` parameter to all Control Center control configurations. This allows users to override the default display text shown on their controls without changing the underlying entity name. ### Implementation Details **Controls Updated (19 total):** 1. Button 2. Switch 3. Light 4. Cover 5. Scene 6. Script 7. OpenPage 8. Assist 9. OpenEntity 10. OpenSwitch 11. OpenLight 12. OpenCoverEntity 13. OpenInputBoolean 14. OpenLock 15. OpenCamera 16. OpenSensor **Pattern Applied:** - Added `@Parameter` for `displayText: String?` in each Configuration struct - Added `displayText: String?` field to each Item struct - Updated value providers to pass displayText through to items - Updated control widgets to use `displayText ?? defaultText` pattern for labels - Parameter is optional, maintaining backward compatibility - Fixed SwiftFormat lint issues by wrapping long lines **Files Modified:** 28 files total - 19 Configuration/ValueProvider files - 19 Control widget files (some combined in same file) All changes maintain backward compatibility - existing controls will continue to work without modification. <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > To each Control center control that we have, add a new parameter to control configuration where the user can override the display text </details> <!-- START COPILOT CODING AGENT TIPS --> --- 💬 We'd love your input! Share your thoughts on Copilot coding agent in our [2 minute survey](https://gh.io/copilot-coding-agent-survey). --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com> |
||
|
|
2aa5c551b8
|
Add domain-specific controls for iOS Control Center (#4093)
## Implementation Plan for Domain-Specific Open Entity Controls **Phase 1 - Initial 3 controls (COMPLETED):** - [x] Add WidgetsKind cases for camera, lock, cover - [x] Create ControlOpenCamera, ControlOpenLock, ControlOpenCoverEntity - [x] Add localization strings and tests **Phase 2 - Complete all domains (COMPLETED):** - [x] Add WidgetsKind cases for remaining domains - [x] Create all 11 remaining controls - [x] Add localization strings for all new controls - [x] Register all controls in WidgetsBundle18 - [x] Update tests for all new cases - [x] Add files to Xcode project - [x] Fix localization keys for snake_case domains **Phase 3 - Code optimization (COMPLETED):** - [x] Refactor all controls to use shared OpenEntityAppIntent - [x] Remove 14 duplicate AppIntent files - [x] Update Xcode project references - [x] Clean up backup files **Phase 4 - Refinement (COMPLETED):** - [x] Combine sensor and binary_sensor into single control - [x] Remove script, scene, zone, and person controls - [x] Update all references and localization **Phase 5 - Convert button to action control (COMPLETED):** - [x] Convert ControlOpenButton to ControlButton (stateless press action) - [x] Create ButtonIntent that executes button.press service - [x] Combine button and input_button domains - [x] Remove ControlOpenInputButton - [x] Update all references and localization - [x] Fix code review issues **Phase 6 - Add beta label (COMPLETED):** - [x] Add beta label to ControlOpenCamera using promptsForUserConfiguration() **Phase 7 - Fix linting (COMPLETED):** - [x] Fix line length warning in ControlOpenInputBooleanValueProvider ## Summary Successfully implemented 8 focused controls for iOS Control Center with all linting issues resolved: **Final 8 Controls:** - **Button** - Stateless action control that presses button/input_button entities - **Camera** - Opens camera entities (with beta label) - **Cover** - Opens cover entities - **Input Boolean** - Opens input_boolean entities - **Light** - Opens light entities - **Lock** - Opens lock entities - **Sensor** - Opens sensor/binary_sensor entities - **Switch** - Opens switch entities All code passes linting checks with proper line width constraints. <!-- START COPILOT CODING AGENT SUFFIX --> <!-- START COPILOT ORIGINAL PROMPT --> <details> <summary>Original prompt</summary> > We have the Open entity control in the app which allows users to add a control in ios control center that opens entities. Please implement one control like this per entity domain, like "Open camera", "Open lock", "Open cover", make sure that the description mentions that the app will open the entity inside the app and not perform any action directly </details> <!-- START COPILOT CODING AGENT TIPS --> --- ✨ Let Copilot coding agent [set things up for you](https://github.com/home-assistant/iOS/issues/new?title=✨+Set+up+Copilot+instructions&body=Configure%20instructions%20for%20this%20repository%20as%20documented%20in%20%5BBest%20practices%20for%20Copilot%20coding%20agent%20in%20your%20repository%5D%28https://gh.io/copilot-coding-agent-tips%29%2E%0A%0A%3COnboard%20this%20repo%3E&assignees=copilot) — coding agent works faster and does higher quality work when set up for your repo. --------- Co-authored-by: copilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com> Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com> |