Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Dec 17, 2025

CarPlay, Watch, and Widgets Configuration Export/Import

Completed Tasks:

  • Create generic GRDB export/import infrastructure
  • Add versioning to export format (v1)
  • Extend to CarPlay, Watch, and Widgets configurations
  • Add export/import UI to CarPlay and Watch config screens
  • Handle imports at app level via URL scheme
  • Add localization strings for all UI messages
  • Fix code review issues
  • Add comprehensive tests for export format
  • Security check passed
  • Fix all linting issues

Summary:

This PR implements a comprehensive, versioned export/import system for CarPlay, Watch, and Widgets configurations with:

Versioned Export Format:

  • ConfigurationExport container with version tracking (v1)
  • File naming: HomeAssistant-{Type}-v{Version}.homeassistant
  • Easy to extend for future format changes

Three Configuration Types:

  • CarPlay: Full tab and quick access configuration
  • Watch: Items and Assist settings
  • Widgets: Individual widget configurations

Two Import Methods:

  1. In-app: File picker in config screens with confirmation
  2. URL scheme: homeassistant://import-config?url=file://... for direct imports

Automatic Migration:

  • Updates server IDs to match current servers
  • Finds entities across all configured servers
  • Preserves all customizations

Apple-Style UI:

  • Confirmation dialogs for all imports
  • Localized strings throughout
  • Error handling with user feedback

All linting issues resolved.

Original prompt

In CarPlay configuration screen let's add a button to share carplay configuration, this share exports a file called "CarPlay.homeassistant", then implement a import flow which will receive this file, import to that users CarPlay configuration and then run the migration flow that we already have to replace serverId if needed, since the user that receives this file will have servers configured with different IDs, even though it is the same server.
User has to approved the import before proceeding


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI and others added 3 commits December 17, 2025 11:16
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
…llback

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Copilot AI changed the title [WIP] Add share and import functionality for CarPlay configuration Add CarPlay configuration export/import with automatic server ID migration Dec 17, 2025
Copilot AI requested a review from bgoncal December 17, 2025 11:23
@bgoncal
Copy link
Member

bgoncal commented Dec 17, 2025

@copilot let's go beyond, let's make CarPlay, Watch and Widgets configuration exportable, and then the App can handle the import flow for all of them directly in home (webview) screen, no need to have the specific feature screen open.
Basically make a GRDB table export/import method. Always requesting the user for confirmation. For UI, try to be as much apple-like as possible. Don't forget to version the exportable file, so we can keep track of which filme version model the user is trying to import in case we change the logic in the future

Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

@copilot let's go beyond, let's make CarPlay, Watch and Widgets configuration exportable, and then the App can handle the import flow for all of them directly in home (webview) screen, no need to have...

I'll expand the feature to support CarPlay, Watch, and Widgets configuration export/import with:

  1. Versioned file format (e.g., v1.homeassistant)
  2. Generic GRDB export/import infrastructure
  3. Import handling at app level via URL scheme (homeassistant://import-config)
  4. Apple-style confirmation UI throughout

Working on this now.

Copilot AI and others added 3 commits December 17, 2025 16:14
…gets configs

- Created ConfigurationExportable protocol with versioning support
- Added ConfigurationExport container with v1 format
- Made CarPlayConfig, WatchConfig, and CustomWidget conform to protocol
- Created ConfigurationManager for centralized import/export
- Updated CarPlayConfigurationViewModel to use new infrastructure
- Added export/import UI to WatchConfigurationView
- Added URL handler for homeassistant://import-config
- File names now include version: HomeAssistant-CarPlay-v1.homeassistant

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
…zation

- Fixed extra closing brace in CarPlayConfigurationViewModel
- Renamed importWidgetsConfiguration to importWidgetConfiguration (singular)
- Added localization strings for import confirmation UI
- Updated IncomingURLHandler to use L10n instead of hardcoded strings
- Added Config.Import localization enum with success and confirmation messages

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
- Added test for ConfigurationExport container format
- Added test for versioned filenames (HomeAssistant-{Type}-v1.homeassistant)
- Verify version, type, and data encoding/decoding
- Test all three configuration types (CarPlay, Watch, Widgets)

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Copilot AI changed the title Add CarPlay configuration export/import with automatic server ID migration Add versioned export/import for CarPlay, Watch, and Widgets configurations Dec 17, 2025
@bgoncal
Copy link
Member

bgoncal commented Dec 17, 2025

@copilot fix lint issues

2025-12-17T22:43:11.6305895Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationManager.swift:14:1: warning: (opaqueGenericParameters) Use opaque generic parameters (some Protocol) instead of generic parameters with constraints (T where T: Protocol, etc) where equivalent. Also supports primary associated types for common standard library types, so definitions like T where T: Collection, T.Element == Foo are updated to some Collection<Foo>. 2025-12-17T22:43:11.6366635Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:9:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6383797Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:18:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6385862Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:29:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6387977Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:33:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6389921Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:45:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6391860Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:58:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6393783Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:61:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6395692Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:70:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6398220Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:73:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6400150Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:80:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6402087Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:83:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6404007Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:88:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6406008Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:91:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6408054Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:94:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6409945Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:99:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6411848Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:103:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6414035Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:106:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6415948Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:109:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6418025Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:117:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6419936Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:122:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6421841Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:125:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6423756Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:127:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:11.6425644Z /home/runner/work/iOS/iOS/Sources/Shared/Config/ConfigurationExportable.swift:138:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8189290Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:80:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8191237Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:81:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8193109Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:82:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8194934Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:83:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8196931Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:84:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8198736Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:85:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8200555Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:86:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8202346Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:87:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8204430Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:88:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8206193Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:89:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8208143Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:90:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8209908Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:91:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8211669Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:92:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8213425Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:93:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8215197Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:94:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8217292Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:95:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8219289Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:96:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8221052Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:97:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8222822Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:98:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8224598Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:99:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8226532Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:100:1: warning: (indent) Indent code in accordance with the scope level. 2025-12-17T22:43:12.8228368Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:723:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8230219Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:730:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8232048Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:735:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8233824Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:751:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:12.8235681Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:753:1: warning: (hoistPatternLet) Reposition let or var bindings within pattern. 2025-12-17T22:43:12.8237801Z /home/runner/work/iOS/iOS/Sources/App/WebView/IncomingURLHandler.swift:759:1: warning: (hoistPatternLet) Reposition let or var bindings within pattern. 2025-12-17T22:43:14.7574679Z /home/runner/work/iOS/iOS/Sources/App/Settings/CarPlay/CarPlayConfigurationViewModel.swift:166:1: warning: (trailingSpace) Remove trailing space at end of a line. 2025-12-17T22:43:15.9788450Z /home/runner/work/iOS/iOS/Sources/App/Settings/AppleWatch/HomeCustomization/WatchConfigurationViewModel.swift:149:1: warning: (trailingSpace) Remove trailing space at end of a line.

…ue generics

- Removed all trailing spaces from ConfigurationExportable.swift
- Fixed indentation in IncomingURLHandler.swift (camera case)
- Changed generic parameter to opaque generic (some ConfigurationExportable)
- Fixed hoistPatternLet warnings (repositioned let bindings in switch cases)
- Removed trailing spaces from ViewModel files

Co-authored-by: bgoncal <5808343+bgoncal@users.noreply.github.com>
Copy link
Contributor Author

Copilot AI commented Dec 17, 2025

@copilot fix lint issues

`...

Fixed all linting issues in commit f7476f0:

  • Removed trailing spaces from all affected files
  • Fixed indentation in IncomingURLHandler.swift
  • Changed generic parameter to opaque generic (some ConfigurationExportable)
  • Fixed hoistPatternLet warnings by repositioning let bindings in switch cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants