-
-
Notifications
You must be signed in to change notification settings - Fork 43
Add iOS Live Activity push support #278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
rwarner
wants to merge
8
commits into
home-assistant:main
Choose a base branch
from
rwarner:feat/ios-live-activity
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1451c9f
Add iOS Live Activity push support via direct APNs HTTP/2
rwarner 7dc11f7
Consolidate Live Activity payload builder into ios.js
rwarner 7273578
Rename live-activity.test.js to ios.test.js
rwarner 4bbfeef
Address Copilot review feedback and add explanatory comments
rwarner 90a1e28
Refactor Live Activities to use FCM native liveActivityToken
rwarner 68e32b1
Apply rate limiting uniformly to all Live Activity events
rwarner e789904
Add test verifying attributes-type is only set on start events
rwarner 67feffd
Fix Prettier formatting in ios.test.js
rwarner File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,32 @@ | ||
| { | ||
| "input": { | ||
| "push_token": "test:fcm-token-123", | ||
| "live_activity_token": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "message": "Washer cycle complete", | ||
| "title": "Laundry", | ||
| "registration_info": { | ||
| "app_id": "io.robbie.HomeAssistant", | ||
| "app_version": "2024.1", | ||
| "os_version": "17.0" | ||
| }, | ||
| "data": { | ||
| "event": "end", | ||
| "activity_id": "laundry-001", | ||
| "content_state": { | ||
| "message": "Washer cycle complete", | ||
| "icon": "mdi:washing-machine-off" | ||
| }, | ||
| "dismissal_date": 1234571490 | ||
| } | ||
| }, | ||
| "expected": { | ||
| "updateRateLimits": true, | ||
| "liveActivityToken": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "apsEvent": "end", | ||
| "contentState": { | ||
| "message": "Washer cycle complete", | ||
| "icon": "mdi:washing-machine-off" | ||
| }, | ||
| "dismissalDate": 1234571490 | ||
| } | ||
| } |
41 changes: 41 additions & 0 deletions
41
functions/test/fixtures/live-activity/start-push-to-start.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| { | ||
| "input": { | ||
| "push_token": "test:fcm-token-123", | ||
| "live_activity_token": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "message": "Laundry started", | ||
| "title": "Laundry", | ||
| "registration_info": { | ||
| "app_id": "io.robbie.HomeAssistant", | ||
| "app_version": "2024.1", | ||
| "os_version": "17.2" | ||
| }, | ||
| "data": { | ||
| "event": "start", | ||
| "activity_id": "laundry-001", | ||
| "content_state": { | ||
| "message": "Laundry started", | ||
| "progress": 0, | ||
| "progress_max": 3600, | ||
| "icon": "mdi:washing-machine", | ||
| "color": "#2196F3" | ||
| } | ||
| } | ||
| }, | ||
| "expected": { | ||
| "updateRateLimits": true, | ||
| "liveActivityToken": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "apsEvent": "start", | ||
| "attributesType": "HALiveActivityAttributes", | ||
| "attributes": { | ||
| "tag": "laundry-001", | ||
| "title": "Laundry" | ||
| }, | ||
| "contentState": { | ||
| "message": "Laundry started", | ||
| "progress": 0, | ||
| "progress_max": 3600, | ||
| "icon": "mdi:washing-machine", | ||
| "color": "#2196F3" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,36 @@ | ||
| { | ||
| "input": { | ||
| "push_token": "test:fcm-token-123", | ||
| "live_activity_token": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "message": "Washer is done", | ||
| "title": "Laundry", | ||
| "registration_info": { | ||
| "app_id": "io.robbie.HomeAssistant", | ||
| "app_version": "2024.1", | ||
| "os_version": "17.0" | ||
| }, | ||
| "data": { | ||
| "event": "update", | ||
| "activity_id": "laundry-001", | ||
| "content_state": { | ||
| "message": "Washer is done", | ||
| "progress": 3600, | ||
| "progress_max": 3600, | ||
| "icon": "mdi:washing-machine", | ||
| "color": "#2196F3" | ||
| } | ||
| } | ||
| }, | ||
| "expected": { | ||
| "updateRateLimits": true, | ||
| "liveActivityToken": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "apsEvent": "update", | ||
| "contentState": { | ||
| "message": "Washer is done", | ||
| "progress": 3600, | ||
| "progress_max": 3600, | ||
| "icon": "mdi:washing-machine", | ||
| "color": "#2196F3" | ||
| } | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| { | ||
| "input": { | ||
| "push_token": "test:fcm-token-123", | ||
| "live_activity_token": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "message": "Timer running", | ||
| "title": "Kitchen Timer", | ||
| "registration_info": { | ||
| "app_id": "io.robbie.HomeAssistant", | ||
| "app_version": "2024.1", | ||
| "os_version": "17.0" | ||
| }, | ||
| "data": { | ||
| "event": "update", | ||
| "activity_id": "timer-001", | ||
| "content_state": { | ||
| "message": "45 min remaining", | ||
| "critical_text": "45 min", | ||
| "progress": 2700, | ||
| "progress_max": 3600, | ||
| "chronometer": true, | ||
| "countdown_end": "2024-01-01T12:00:00Z", | ||
| "icon": "mdi:timer", | ||
| "color": "#FF5722" | ||
| }, | ||
| "stale_date": 1234571490, | ||
| "relevance_score": 0.8, | ||
| "alert": { | ||
| "title": "Timer Update", | ||
| "body": "45 minutes remaining" | ||
| }, | ||
| "alert_sound": "default" | ||
| } | ||
| }, | ||
| "expected": { | ||
| "updateRateLimits": true, | ||
| "liveActivityToken": "a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2c3d4e5f6a1b2", | ||
| "apsEvent": "update", | ||
| "contentState": { | ||
| "message": "45 min remaining", | ||
| "critical_text": "45 min", | ||
| "progress": 2700, | ||
| "progress_max": 3600, | ||
| "chronometer": true, | ||
| "countdown_end": "2024-01-01T12:00:00Z", | ||
| "icon": "mdi:timer", | ||
| "color": "#FF5722" | ||
| }, | ||
| "staleDate": 1234571490, | ||
| "relevanceScore": 0.8, | ||
| "alert": { | ||
| "title": "Timer Update", | ||
| "body": "45 minutes remaining" | ||
| }, | ||
| "alertSound": "default" | ||
| } | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.