Skip to content

Fine tuning Live Activity implementation#4696

Open
bgoncal wants to merge 15 commits into
mainfrom
live-activity-last-mile
Open

Fine tuning Live Activity implementation#4696
bgoncal wants to merge 15 commits into
mainfrom
live-activity-last-mile

Conversation

@bgoncal

@bgoncal bgoncal commented Jun 3, 2026

Copy link
Copy Markdown
Member

Summary

  • Add Live Activity data model translation updates, including support for dynamic title content.
  • Provide per-activity push token TTL/expiry metadata to Home Assistant core via expires_at.
  • Normalize expires_at to whole-second epoch values to keep the webhook contract stable and avoid fractional timestamp inconsistencies.
  • Align Live Activity contract test expectations with the intentional shipped Keychain key (live_activity_token) to keep the test contract consistent with production behavior.

Screenshots

N/A (no user-facing UI changes in this follow-up adjustment)

Link to pull request in Documentation repository

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

Any other notes

CC @rwarner

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 pull request fine-tunes the Live Activity implementation by extending the Live Activity content model to support a dynamically updateable title, and by reporting a per-activity push token expiration timestamp back to Home Assistant core.

Changes:

  • Add title to HALiveActivityAttributes.ContentState and plumb it through notification payload parsing and Live Activity UI rendering.
  • Extend the per-activity push token webhook payload with an expires_at field and freeze the TTL contract in tests.
  • Add a DEBUG-only switch to optionally disable local push handling during Live Activity testing.

Reviewed changes

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

Show a summary per file
File Description
Tests/Shared/LiveActivity/LiveActivityContractTests.swift Updates wire-format contract tests for new title key and expires_at/TTL assertions.
Tests/Shared/LiveActivity/HandlerLiveActivityTests.swift Extends handler tests to validate parsing of the new title field.
Sources/Shared/Notifications/NotificationCommands/HandlerLiveActivity.swift Parses title into the dynamic Live Activity content state.
Sources/Shared/LiveActivity/LiveActivityRegistry.swift Adds expires_at reporting for push tokens and defines TTL contract constant.
Sources/Shared/LiveActivity/HALiveActivityAttributes.swift Adds title to ContentState with explicit CodingKeys + Codable support.
Sources/Extensions/Widgets/LiveActivity/HALockScreenView.swift Uses dynamic state.title when present, falling back to attributes title.
Sources/Extensions/Widgets/LiveActivity/HADynamicIslandView.swift Uses dynamic state.title when present, falling back to attributes title.
Sources/App/Notifications/NotificationManager.swift Adds DEBUG-only toggle to force-disallow local push interface for testing.

Comment thread Sources/Shared/LiveActivity/LiveActivityRegistry.swift Outdated
Comment thread Tests/Shared/LiveActivity/LiveActivityContractTests.swift
@codecov

codecov Bot commented Jun 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 38.46154% with 8 lines in your changes missing coverage. Please review.
⚠️ Please upload report for BASE (main@af16cb3). Learn more about missing BASE report.

Files with missing lines Patch % Lines
...ces/Shared/LiveActivity/LiveActivityRegistry.swift 0.00% 4 Missing ⚠️
...Shared/LiveActivity/HALiveActivityAttributes.swift 33.33% 2 Missing ⚠️
Sources/Shared/API/HAAPI.swift 0.00% 1 Missing ⚠️
...ficationCommands/NotificationsCommandManager.swift 66.66% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4696   +/-   ##
=======================================
  Coverage        ?   44.86%           
=======================================
  Files           ?      275           
  Lines           ?    16754           
  Branches        ?        0           
=======================================
  Hits            ?     7517           
  Misses          ?     9237           
  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.

Copilot AI changed the title Fine tuning live activity implementation Fine tuning Live Activity implementation Jun 3, 2026
@bgoncal bgoncal marked this pull request as ready for review June 4, 2026 22:30
@github-actions

github-actions Bot commented Jun 18, 2026

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 1653 L10n strings

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

Checking for unused strings...
Checked 100/1653 strings...
Checked 200/1653 strings...
Checked 300/1653 strings...
Checked 400/1653 strings...
Checked 500/1653 strings...
Checked 600/1653 strings...
Checked 700/1653 strings...
Checked 800/1653 strings...
Checked 900/1653 strings...
Checked 1000/1653 strings...
Checked 1100/1653 strings...
Checked 1200/1653 strings...
Checked 1300/1653 strings...
Checked 1400/1653 strings...
Checked 1500/1653 strings...
Checked 1600/1653 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: 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: 3836
  - L10n.SettingsDetails.Actions.Scenes.customizeAction
    Key: settings_details.actions.scenes.customize_action
    Line: 3854

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

WIDGETS:
  - L10n.Widgets.Controls.Automations.placeholderTitle
    Key: widgets.controls.automations.placeholder_title
    Line: 5719
  - L10n.Widgets.Controls.Button.placeholderTitle
    Key: widgets.controls.button.placeholder_title
    Line: 5727
  - L10n.Widgets.Controls.Cover.placeholderTitle
    Key: widgets.controls.cover.placeholder_title
    Line: 5737
  - L10n.Widgets.Controls.Fan.placeholderTitle
    Key: widgets.controls.fan.placeholder_title
    Line: 5747
  - L10n.Widgets.Controls.Light.placeholderTitle
    Key: widgets.controls.light.placeholder_title
    Line: 5757
  - L10n.Widgets.Controls.Scenes.placeholderTitle
    Key: widgets.controls.scenes.placeholder_title
    Line: 5911
  - L10n.Widgets.Controls.Scripts.placeholderTitle
    Key: widgets.controls.scripts.placeholder_title
    Line: 5923
  - L10n.Widgets.Controls.Switch.placeholderTitle
    Key: widgets.controls.switch.placeholder_title
    Line: 5931

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 and others added 3 commits June 19, 2026 10:16
)

Brings the Live Activity settings redesign and DEBUG samples from #4554
into the #4696 fine-tuning branch.

Conflict resolutions:
- DebugView: drop the Live Activity debug link (moved to root Settings by
  #4554), keep #4696/main's carPlayDebugSection.
- SettingsItem: keep #4554's array-based macCatalyst hidden-items filter and
  add main's newer .appIconShortcuts to it.
- LiveActivitySettingsView: keep #4554's isLiveActivitySupportedOnDevice
  guard in the status section.
- Restore live_activity.status.not_supported in en.lproj + Strings.swift
  (main had removed it; #4554's redesigned view references it).
- Locale strings (hu/ko-KR/ru/sv): keep main's translations, drop the removed
  footer/privacy.message/section.privacy keys (consistent with the other
  auto-merged locales).

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Resolve ja/ko-KR Localizable.strings conflicts introduced by integrating
#4554: keep main's latest translations, drop the Live Activity keys removed
by #4554 (frequent_updates.footer, privacy.message, section.privacy),
consistent with the other locales.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.

3 participants