Skip to content

fix(push): use onNewRegistrationToken instead of activate() on FCM token refresh#3282

Merged
maratal merged 1 commit intomainfrom
dx-973-Push-activate-a-noop
Apr 16, 2026
Merged

fix(push): use onNewRegistrationToken instead of activate() on FCM token refresh#3282
maratal merged 1 commit intomainfrom
dx-973-Push-activate-a-noop

Conversation

@maratal
Copy link
Copy Markdown
Collaborator

@maratal maratal commented Mar 18, 2026

Summary

  • Replaces push.activate() in onNewToken with push.getActivationContext().onNewRegistrationToken(RegistrationToken.Type.FCM, token)
  • activate() triggers a full device registration flow (CalledActivate state machine event), which is wrong for a token refresh
  • onNewRegistrationToken fires GotPushDeviceDetails — updating the stored token and re-registering with Ably only if the device is already activated
  • Adds missing import io.ably.lib.types.RegistrationToken

🤖 Generated with Claude Code

https://ably.atlassian.net/browse/DX-973

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Mar 18, 2026

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: c6b41711-bb4b-4ae3-8111-8de9fa479cf6

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dx-973-Push-activate-a-noop

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 and usage tips.

@maratal maratal added the review-app Create a Heroku review app label Mar 18, 2026
@ably-ci ably-ci temporarily deployed to ably-docs-dx-973-push-a-hznskz March 18, 2026 16:29 Inactive
@maratal maratal requested a review from sacOO7 March 20, 2026 17:26
@maratal maratal requested review from umair-ably and removed request for lawrence-forooghian and sacOO7 April 16, 2026 12:21
…ken refresh

Calling activate() in onNewToken triggers a full device registration flow
(CalledActivate state machine event). The correct approach is onNewRegistrationToken,
which fires GotPushDeviceDetails — updating the stored token and re-registering
with Ably only if the device is already activated.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@maratal maratal force-pushed the dx-973-Push-activate-a-noop branch from 1d287b4 to 268a7bb Compare April 16, 2026 12:57
@maratal maratal merged commit d778bbc into main Apr 16, 2026
7 checks passed
@maratal maratal deleted the dx-973-Push-activate-a-noop branch April 16, 2026 13:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review-app Create a Heroku review app

Development

Successfully merging this pull request may close these issues.

3 participants