Skip to content

fix: [SDK-5580] end duplicate Live Activities and keep the update token - #1780

Draft
nan-li wants to merge 3 commits into
mainfrom
nan/sdk-5580
Draft

nan-li wants to merge 3 commits into
mainfrom
nan/sdk-5580

Conversation

@nan-li

@nan-li nan-li commented Oct 20, 2026 •

Copy link
Copy Markdown
Contributor

Description

One Line Summary

End duplicate Live Activities at startup and keep their shared update token when one is dismissed. SDK-5580.

Details

Motivation

When two subscriptions on one device hold the same push-to-start token, one push starts two Live Activities with the same OneSignal activityId. They share one update token registration, so only the activity registered last receives updates, and dismissing either one removed the registration and froze the other.

Scope

  • Dismissing an activity no longer removes the update token while another live activity of the same type has the same activityId.
  • In setup(), live activities that share an activityId are reduced to one. The SDK keeps the activity whose push token matches the cached update token, otherwise the first one with a token, ends the rest immediately, and attaches listeners only to the kept one. Needs iOS 16.2, like the existing dedupe of newly started activities.
  • Nothing changes for activities without a duplicate, or for apps that call enter and exit themselves.

Testing

Unit testing

Tests with fake activities cover grouping by activityId (ended and dismissed activities excluded), choosing the activity to keep, ending all but one per group, and the dismissal check. Two executor tests cover reading the cached update token, including when a removal is pending. ActivityKit activities cannot be created in unit tests, so the wiring in listenForActivity is not covered.

Manual testing

The full Reduced unit test plan passes locally on an iPhone 17 Pro simulator (iOS 26.5), 647 tests with 0 failures. Not run on a device with duplicate Live Activities.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
  • I have reviewed this PR myself, ensuring it meets each checklist item

🤖 Generated with Claude Code

Activities with the same OneSignal activityId share one update token registration,
so dismissing a duplicate froze the survivor and only the last registered widget updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant