Skip to content

fix: pass user attributes during loginUserWithUserAttributes on Android#391

Merged
imSzukala merged 2 commits intomainfrom
irena/user-attributes
Mar 13, 2026
Merged

fix: pass user attributes during loginUserWithUserAttributes on Android#391
imSzukala merged 2 commits intomainfrom
irena/user-attributes

Conversation

@imSzukala
Copy link
Contributor

@imSzukala imSzukala commented Mar 11, 2026

Why?

Fixes:

loginUserWithUserAttributes on Android was silently dropping all user attributes (e.g. name, customAttributes) except email and userId. The Registration object was built from the params but withUserAttributes() was never called, so only the identity fields reached Intercom's backend.

How?

Call IntercomHelpers.buildUserAttributes(params) and attach the result via registration.withUserAttributes(userAttributes) before passing the registration to loginIdentifiedUser. The fix is applied to both the newarch and oldarch Android modules. The TypeScript type signature is also widened from Pick<UserAttributes, 'email' | 'userId'> to UserAttributes & ({ email: string } | { userId: string }) so callers can pass the full set of attributes.

Implementation Plan

Push commit and open PR against master

Context

Commit 132d0d1 on branch irena/user-attributes fixes a bug where Android was silently dropping all user attributes except email and userId during loginUserWithUserAttributes. The branch has no remote tracking yet.

Steps

  1. Discard local unstaged changes in examples/example/src/App.tsx (revert to HEAD)
  2. Push irena/user-attributes to origin with -u flag
  3. Create PR against master using gh pr create
    • Title: fix: pass user attributes during loginUserWithUserAttributes on Android
    • Body: summary of the Android fix (newarch + oldarch modules, type signature update)

Generated with Claude Code

imSzukala and others added 2 commits March 12, 2026 10:55
The Android native module was silently dropping all attributes except
email and userId when calling loginUserWithUserAttributes. This chains
Registration.withUserAttributes() using the existing buildUserAttributes
helper, matching the iOS behavior. Also updates the TypeScript type to
accept full UserAttributes instead of only email/userId.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Address PR review feedback: the union type enforcing email|userId at
compile time is unnecessary since the native layer validates at runtime.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@imSzukala imSzukala force-pushed the irena/user-attributes branch from 132d0d1 to 17c989f Compare March 12, 2026 10:05
@imSzukala
Copy link
Contributor Author

Addressed the review feedback — simplified the loginUserWithUserAttributes type from UserAttributes & ({ email: string } | { userId: string }) to just UserAttributes.

The native layer already validates that at least one identifier (email or userId) is present at runtime, so the compile-time union type was adding complexity without meaningful safety benefit.

@imSzukala imSzukala requested a review from mamut March 12, 2026 10:06
@imSzukala imSzukala merged commit 036a4a7 into main Mar 13, 2026
8 checks passed
@imSzukala imSzukala deleted the irena/user-attributes branch March 13, 2026 11:55
@imSzukala imSzukala mentioned this pull request Mar 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants