Skip to content

Add API for registering Live Activity push-to-start token#2219

Merged
ttypic merged 1 commit into
mainfrom
AIT-465/liveactivity-pts-activation
Jul 9, 2026
Merged

Add API for registering Live Activity push-to-start token#2219
ttypic merged 1 commit into
mainfrom
AIT-465/liveactivity-pts-activation

Conversation

@ttypic

@ttypic ttypic commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Changes Introduced

registerPushToStartToken: Allows the addition of a token to an already-activated device and syncs the updated recipient to Ably using the existing PATCH path.

Example App

https://github.com/ttypic/liveactivity-example

Docs

ably/docs#3464

Summary by CodeRabbit

  • New Features
    • Added support for registering and syncing push-to-start tokens for Live Activities on iOS.
    • Existing device storage now recognizes this token type and restores it when available.
  • Bug Fixes
    • Resetting push device details now clears push-to-start token state along with other APNS token types.
  • Tests
    • Added coverage for saving, loading, and sending push-to-start tokens during device registration updates.

AIT-465

Add iOS-only API on ARTPush for registering an Apple Live Activity
push-to-start token (Activity.pushToStartTokenUpdates) with Ably:

`registerPushToStartToken`: adds the token to an already-activated
  device, syncing the updated recipient to Ably via the existing PATCH
  path.
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown

Review Change Stack

Walkthrough

This PR introduces a "pushToStart" APNS device token type for Live Activity support. It adds a new constant, extends local device storage load/reset logic, adds registerPushToStartToken: methods across ARTPush, ARTPushInternal, ARTWrapperSDKProxyPush, and ARTPushProtocol, and includes corresponding tests.

Changes

Push-to-start token feature

Layer / File(s) Summary
Push-to-start token type and local device storage
Source/ARTLocalDevice.m, Source/PrivateHeaders/Ably/ARTLocalDevice+Private.h
Adds ARTAPNSDevicePushToStartTokenType constant and header declaration; extends supported token types in device load and clears the token in resetDetails.
registerPushToStartToken API and delegation
Source/ARTPush.m, Source/PrivateHeaders/Ably/ARTPush+Private.h, Source/ARTWrapperSDKProxyPush.m, Source/include/Ably/ARTPush.h
Adds public ARTPush method, internal ARTPushInternal implementation persisting the token, wrapper proxy delegation, and protocol declaration with Swift naming and documentation.
Tests for push-to-start registration and activation
Test/AblyTests/Tests/PushTests.swift, Test/AblyTests/Tests/PushActivationStateMachineTests.swift
Adds a token fixture and tests validating token persistence after registerPushToStartToken and that activation PATCH requests include the pushToStart token.

Estimated code review effort: 2 (Simple) | ~12 minutes

Possibly related PRs

  • ably/ably-cocoa#2207: Both PRs modify Source/ARTLocalDevice.m's device restore/reset logic for APNS device token persistence.

Suggested reviewers: lawrence-forooghian, umair-ably

Poem

A hop, a skip, a token new,
"pushToStart" now hopping through,
Persisted safe in storage deep,
Live Activities wake from sleep. 🐰📲
Tests confirm it, PATCH sails clean —
The happiest rabbit code has seen!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: adding an API to register Live Activity push-to-start tokens.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch AIT-465/liveactivity-pts-activation

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@maratal

maratal commented Jul 8, 2026

Copy link
Copy Markdown
Collaborator

From the app description:

iOS app in this example does not integrate the Ably SDK

What do you mean? It calls push.activate(), right? @ttypic

Comment thread Source/include/Ably/ARTPush.h
@ttypic

ttypic commented Jul 9, 2026

Copy link
Copy Markdown
Contributor Author

iOS app in this example does not integrate the Ably SDK

@maratal I just forgot to update readme, original example was without ably integration, I then replaced it

@ttypic ttypic merged commit 3a0c8c1 into main Jul 9, 2026
14 of 16 checks passed
@ttypic ttypic deleted the AIT-465/liveactivity-pts-activation branch July 9, 2026 12:55
@ttypic ttypic mentioned this pull request Jul 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants