Skip to content

Improve CarPlay settings selection avoiding screen blinks#4820

Draft
bgoncal wants to merge 1 commit into
mainfrom
carplay-setting-2
Draft

Improve CarPlay settings selection avoiding screen blinks#4820
bgoncal wants to merge 1 commit into
mainfrom
carplay-setting-2

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 23, 2026

Copy link
Copy Markdown
Member

Summary

Screenshots

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#

Any other notes

@bgoncal bgoncal self-assigned this Jun 23, 2026
Copilot AI review requested due to automatic review settings June 23, 2026 19:46
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 21 unused localization strings in the codebase.

Click to see details
Parsing Strings.swift...
Found 1712 L10n strings

Reading all Swift source code...
Read 5742596 characters of Swift code

Checking for unused strings...
Checked 100/1712 strings...
Checked 200/1712 strings...
Checked 300/1712 strings...
Checked 400/1712 strings...
Checked 500/1712 strings...
Checked 600/1712 strings...
Checked 700/1712 strings...
Checked 800/1712 strings...
Checked 900/1712 strings...
Checked 1000/1712 strings...
Checked 1100/1712 strings...
Checked 1200/1712 strings...
Checked 1300/1712 strings...
Checked 1400/1712 strings...
Checked 1500/1712 strings...
Checked 1600/1712 strings...
Checked 1700/1712 strings...

================================================================================
UNUSED STRINGS REPORT
================================================================================

Found 21 unused strings:


ACTIONSCONFIGURATOR:
  - L10n.ActionsConfigurator.Action.createAutomation
    Key: actions_configurator.action.create_automation
    Line: 132
  - L10n.ActionsConfigurator.VisualSection.sceneDefined
    Key: actions_configurator.visual_section.scene_defined
    Line: 172
  - L10n.ActionsConfigurator.VisualSection.serverDefined
    Key: actions_configurator.visual_section.server_defined
    Line: 178

APPINTENTS:
  - L10n.AppIntents.WidgetAction.actionsParameterConfiguration
    Key: app_intents.widget_action.actions_parameter_configuration
    Line: 612

CAMERA:
  - L10n.Camera.serverNotFound
    Key: camera.server_not_found
    Line: 770
  - L10n.Camera.snapshotFailed
    Key: camera.snapshot_failed
    Line: 772

CAMERALIST:
  - L10n.CameraList.noArea
    Key: camera_list.no_area
    Line: 777
  - L10n.CameraList.searchPlaceholder
    Key: camera_list.search_placeholder
    Line: 779

CAMERAS:
  - L10n.Cameras.dragToReorder
    Key: cameras.drag_to_reorder
    Line: 835

SETTINGSDETAILS:
  - L10n.SettingsDetails.Actions.ActionsSynced.footerNoActions
    Key: settings_details.actions.actions_synced.footer_no_actions
    Line: 3948
  - L10n.SettingsDetails.Actions.Scenes.customizeAction
    Key: settings_details.actions.scenes.customize_action
    Line: 3966

URLHANDLER:
  - L10n.UrlHandler.Error.actionNotFound
    Key: url_handler.error.action_not_found
    Line: 4785

WIDGETS:
  - L10n.Widgets.Controls.Automations.placeholderTitle
    Key: widgets.controls.automations.placeholder_title
    Line: 5837
  - L10n.Widgets.Controls.Button.placeholderTitle
    Key: widgets.controls.button.placeholder_title
    Line: 5845
  - L10n.Widgets.Controls.Cover.placeholderTitle
    Key: widgets.controls.cover.placeholder_title
    Line: 5855
  - L10n.Widgets.Controls.Fan.placeholderTitle
    Key: widgets.controls.fan.placeholder_title
    Line: 5865
  - L10n.Widgets.Controls.Light.placeholderTitle
    Key: widgets.controls.light.placeholder_title
    Line: 5875
  - L10n.Widgets.Controls.Scenes.placeholderTitle
    Key: widgets.controls.scenes.placeholder_title
    Line: 6029
  - L10n.Widgets.Controls.Scripts.placeholderTitle
    Key: widgets.controls.scripts.placeholder_title
    Line: 6041
  - L10n.Widgets.Controls.Switch.placeholderTitle
    Key: widgets.controls.switch.placeholder_title
    Line: 6049

ROOT:
  - L10n.noArea
    Key: no_area
    Line: 36

================================================================================
Total unused: 21
================================================================================

To clean up these strings, manually remove them from the Localizable.strings files
and regenerate Strings.swift using SwiftGen.

@bgoncal bgoncal marked this pull request as draft June 23, 2026 19:50

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates the CarPlay Settings selection flows (main server and quick access layout) to avoid UI “blinks” by deferring persistence until the user leaves the selection list, while keeping the selected checkmark updated in-place.

Changes:

  • Introduces pending selection state in CarPlayServerListViewModel for server and layout choices, committed when the selection template disappears.
  • Updates CarPlayServersListTemplate selection templates to refresh sections in-place (checkmark updates) instead of immediately popping the template.
  • Commits pending selections in templateWillDisappear for server/layout selection templates.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
Sources/CarPlay/Templates/Servers/CarPlayServerListViewModel.swift Adds pending server/layout selection state and commit logic to defer persistence and reduce UI blinking.
Sources/CarPlay/Templates/Servers/CarPlayServerListTemplate.swift Updates CarPlay selection templates to update checkmarks via updateSections and commit on template disappearance.

Comment on lines +142 to +145
guard pendingLayout != quickAccessLayout else {
return
}

Comment on lines +41 to +52
func commitServerSelection() {
guard let pendingServer else {
return
}
self.pendingServer = nil

guard pendingServer.identifier != CarPlayPreferredServer.current?.identifier else {
return
}

setServer(server: pendingServer)
}
@codecov

codecov Bot commented Jun 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
⚠️ Please upload report for BASE (main@c01af4c). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4820   +/-   ##
=======================================
  Coverage        ?   45.02%           
=======================================
  Files           ?      278           
  Lines           ?    16996           
  Branches        ?        0           
=======================================
  Hits            ?     7652           
  Misses          ?     9344           
  Partials        ?        0           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants