Skip to content

Disfavor non-essential widgets in CarPlay widget gallery#4733

Open
bgoncal wants to merge 4 commits into
mainfrom
laughing-matsumoto-57025a
Open

Disfavor non-essential widgets in CarPlay widget gallery#4733
bgoncal wants to merge 4 commits into
mainfrom
laughing-matsumoto-57025a

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 11, 2026

Copy link
Copy Markdown
Member

Summary

Marks every widget except the most driving-relevant ones as disfavored in the CarPlay widget gallery, using SwiftUI's disfavoredLocations(_:for:) with WidgetLocation.carPlay. Disfavored widgets are moved to the "Other" section of the CarPlay gallery instead of being suggested up front.

Disfavored in CarPlay: Assist, Scripts, Gauge, Details, Sensors, Open Page.

Kept favored (unchanged): Commonly Used Entities, Custom, and To-do List — the widgets most useful at a glance while driving.

Implementation notes:

  • A small disfavoredInCarPlayIfAvailable(for:) helper (Sources/Extensions/Widgets/Common/WidgetCarPlayLocation.swift) wraps the API, following the existing contentMarginsDisabledIfAvailable() pattern. The new file is registered in project.pbxproj for both the App and Extensions-Widgets targets (the two targets that compile widget code).
  • WidgetLocation.carPlay is @available(iOS 26.0, *) (iOS / iPadOS / Mac Catalyst 26.0+) and unavailable on native macOS. Although the disfavoredLocations(_:for:) modifier itself is iOS 17+, the .carPlay location requires iOS 26, so the helper guards on the stricter requirement (#available(iOS 26.0, *)) and on platform (#if !os(macOS)). The iOS availability domain is used rather than iOSApplicationExtension, because the file also compiles into the non-extension App target where an iOSApplicationExtension check would not refine these iOS-only symbols. On earlier OS versions the modifier is a no-op, which is correct since the CarPlay widget location doesn't exist there.
  • Each widget is disfavored for the full set of families it already declares via supportedFamilies.
  • Control widgets (iOS 18+) and the Live Activity use different configuration types that don't appear in the CarPlay widget gallery, so they're untouched.

Screenshots

N/A — this only affects the ordering/section of widgets in the CarPlay widget gallery (the "Other" section) on iOS 26+; there is no visual change to the widgets themselves.

Link to pull request in Documentation repository

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

Any other notes

Family lists are reused verbatim from each widget's existing supportedFamilies declaration, so disfavoring stays in sync if those lists change.

🤖 Generated with Claude Code

Mark the Assist, Scripts, Gauge, Details, Sensors and Open Page widgets
as disfavored in CarPlay via `disfavoredLocations([.carPlay], for:)`, so
they appear in the "Other" section of the CarPlay widget gallery. The
Commonly Used Entities, Custom and To-do List widgets stay favored, as
they are the ones most useful while driving.

A `disfavoredInCarPlayIfAvailable(for:)` helper wraps the iOS 17+ API and
guards macOS, where the API and `WidgetLocation.carPlay` are unavailable.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings June 11, 2026 12:10
@github-actions

github-actions Bot commented Jun 11, 2026

Copy link
Copy Markdown
Contributor

⚠️ Unused L10n strings detected

Found 13 unused localization strings in the codebase.

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

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

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

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

Found 13 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: 606

CAMERA:
  - L10n.Camera.serverNotFound
    Key: camera.server_not_found
    Line: 764
  - L10n.Camera.snapshotFailed
    Key: camera.snapshot_failed
    Line: 766

CAMERALIST:
  - L10n.CameraList.noArea
    Key: camera_list.no_area
    Line: 771
  - L10n.CameraList.searchPlaceholder
    Key: camera_list.search_placeholder
    Line: 773

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

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

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

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

================================================================================
Total unused: 13
================================================================================

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

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

Updates the Widgets extension to mark several non-driving-focused widgets as disfavored in the CarPlay widget gallery (moving them into the “Other” section) by applying a shared WidgetConfiguration helper around SwiftUI’s CarPlay widget-location API.

Changes:

  • Added a WidgetConfiguration.disfavoredInCarPlayIfAvailable(for:) helper to conditionally apply disfavoredLocations([.carPlay], for:) on supported platforms/OS versions.
  • Applied the helper to Assist, Scripts, Gauge, Details, Sensors, and Open Page widgets so they’re deprioritized in the CarPlay widget gallery.
  • Kept favored widgets (Commonly Used Entities, Custom, To-do List) unchanged (per PR description).

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
Sources/Extensions/Widgets/Common/WidgetCarPlayLocation.swift Adds a helper to disfavor widget families specifically for the CarPlay gallery when available.
Sources/Extensions/Widgets/Assist/WidgetAssist.swift Applies the CarPlay disfavoring helper to the Assist widget.
Sources/Extensions/Widgets/Script/WidgetScripts.swift Applies the CarPlay disfavoring helper to the Scripts widget.
Sources/Extensions/Widgets/Lockscreen/Gauge/WidgetGauge.swift Applies the CarPlay disfavoring helper to the Gauge widget.
Sources/Extensions/Widgets/Lockscreen/Details/WidgetDetails.swift Applies the CarPlay disfavoring helper to the Details widget.
Sources/Extensions/Widgets/Sensor/WidgetSensors.swift Applies the CarPlay disfavoring helper to the Sensors widget.
Sources/Extensions/Widgets/OpenPage/WidgetOpenPage.swift Applies the CarPlay disfavoring helper to the Open Page widget.

Comment thread Sources/Extensions/Widgets/Common/WidgetCarPlayLocation.swift
`WidgetLocation.carPlay` is `@available(iOS 26.0, *)` (and unavailable on
macOS), even though the `disfavoredLocations(_:for:)` modifier itself is
iOS 17+. Guarding only on iOS 17 makes the iOS/Mac Catalyst build fail
with "'carPlay' is only available in iOS 26.0 or newer". Guard on the
stricter iOS 26 requirement instead.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@bgoncal bgoncal enabled auto-merge (squash) June 11, 2026 12:24
@bgoncal bgoncal disabled auto-merge June 11, 2026 12:24
bgoncal and others added 2 commits June 11, 2026 14:30
The new helper file was not referenced in project.pbxproj, so it would
not be compiled and `.disfavoredInCarPlayIfAvailable(...)` would fail to
resolve. Register it (file reference, group entry, and build files) in
the same two targets that compile the other Widgets/Common helpers —
`App` and `Extensions-Widgets` — mirroring WidgetContentMargin.swift.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
WidgetCarPlayLocation.swift compiles into both the Widgets extension and
the non-extension `App` target. `disfavoredLocations(_:for:)` and
`WidgetLocation.carPlay` are annotated only in the `iOS` availability
domain, so a `#available(iOSApplicationExtension 26.0, *)` check does not
refine them when compiled without `-application-extension` (the App
target), breaking the build with "only available in iOS 26.0 or newer".
Use `#available(iOS 26.0, *)`, which refines correctly in both targets.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@codecov

codecov Bot commented Jun 11, 2026

Copy link
Copy Markdown

Codecov Report

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

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4733   +/-   ##
=======================================
  Coverage        ?   44.93%           
=======================================
  Files           ?      277           
  Lines           ?    16782           
  Branches        ?        0           
=======================================
  Hits            ?     7541           
  Misses          ?     9241           
  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