feat(inbox): expose trackingIds on InboxMessage - #49
Closed
mikemilla wants to merge 1 commit into
Closed
Conversation
Flutter apps could not track inbox clicks at all. `InboxMessage` had no `trackingIds` field, so `fromJson` dropped the key on the floor, while `CourierClient.inbox.click` requires the caller to pass a `trackingId` — with no way to obtain one from the message. The data was already arriving. Both platform handlers serialize a message with the native SDK's `toJson()`, and both native `InboxMessage` types encode `trackingIds`, so the key has always been present in the payload crossing the platform channel. This model simply never read it. Adds `InboxMessageTrackingIds` covering all seven ids the server publishes (archive, channel, click, deliver, open, read, unread), reads it in `fromJson`, writes it in `toJson`, and adds a `clickTrackingId` convenience accessor for the id `click()` needs. Independent of the `iwpv=v2` work: the field is read from the root of the message, which is where both the GraphQL read and the v2 socket publish it, but nothing here depends on the protocol version or on a native SDK release. This is the one part of the courier-flutter migration that was never blocked. Parsing is defensive — `trackingIds` arrives untyped over a platform channel, so a non-object value yields null rather than throwing. Tests: 7 new unit tests (all seven ids parsed, clickTrackingId accessor, absent, partial, non-object input, toJson round-trip, other fields unaffected). First test directory in this package. `flutter test` 7/7, `flutter analyze` clean. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Collaborator
Author
|
Parking this PR during a PR-cleanup pass. The branch is kept (not deleted) and the work is tracked in C-19804 (cycle 367). Reopening restores everything — branch, commits, and this thread. |
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Ticket: C-19804
Flutter apps could not track inbox clicks at all
InboxMessagehad notrackingIdsfield, sofromJsondropped the key. MeanwhileCourierClient.inbox.clickrequires atrackingId:…with no way to obtain one from the message. So click tracking was effectively unreachable from Dart.
The data was already arriving
Both platform handlers serialize a message with the native SDK's
toJson(), and both nativeInboxMessagetypes encodetrackingIds. The key has always been present in the payload crossing the platform channel — this model just never read it.That's why this part was never blocked, unlike the rest of C-19804: no protocol version, no native SDK release, nothing to wait on.
Change
InboxMessageTrackingIdscovering all seven ids the server publishes: archive, channel, click, deliver, open, read, unreadfromJson, written intoJsonclickTrackingIdconvenience accessor for the idclick()needsnullrather than throwingRead from the root of the message, which is where both the GraphQL read and the
iwpv=v2socket publish it. Nothing here depends on the protocol version.Tests
First test directory in this package.
flutter test7/7,flutter analyzeclean:clickTrackingIdaccessortrackingIdsinputstoJsonround-trip survives a second parse🤖 Generated with Claude Code