From 072f8b61b9f640552bc780ad752c76a9e421bb02 Mon Sep 17 00:00:00 2001 From: Irena Szukala Date: Tue, 10 Mar 2026 16:00:46 +0100 Subject: [PATCH 1/2] fix: pass user attributes during loginUserWithUserAttributes on Android 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 --- android/src/newarch/IntercomModule.java | 3 +++ android/src/oldarch/IntercomModule.java | 3 +++ src/index.tsx | 2 +- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/android/src/newarch/IntercomModule.java b/android/src/newarch/IntercomModule.java index c892bd10..a6e4d8f3 100644 --- a/android/src/newarch/IntercomModule.java +++ b/android/src/newarch/IntercomModule.java @@ -192,6 +192,9 @@ public void loginUserWithUserAttributes(ReadableMap params, Promise promise) { promise.reject(IntercomErrorCodes.IDENTIFIED_REGISTRATION, "Invalid userId or email"); } if (registration != null) { + UserAttributes userAttributes = IntercomHelpers.buildUserAttributes(params); + registration.withUserAttributes(userAttributes); + Intercom.client().loginIdentifiedUser(registration, new IntercomStatusCallback() { @Override public void onSuccess() { diff --git a/android/src/oldarch/IntercomModule.java b/android/src/oldarch/IntercomModule.java index 32afd733..06529479 100644 --- a/android/src/oldarch/IntercomModule.java +++ b/android/src/oldarch/IntercomModule.java @@ -169,6 +169,9 @@ public void loginUserWithUserAttributes(ReadableMap params, Promise promise) { promise.reject(IntercomErrorCodes.IDENTIFIED_REGISTRATION, "Invalid userId or email"); } if (registration != null) { + UserAttributes userAttributes = IntercomHelpers.buildUserAttributes(params); + registration.withUserAttributes(userAttributes); + Intercom.client().loginIdentifiedUser(registration, new IntercomStatusCallback() { @Override public void onSuccess() { diff --git a/src/index.tsx b/src/index.tsx index 856152b1..302911d8 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -102,7 +102,7 @@ export type IntercomType = { * @param params The {@link UserAttributes} object that contains the user's `email` or `userId`. */ loginUserWithUserAttributes: ( - params: Pick + params: UserAttributes & ({ email: string } | { userId: string }) ) => Promise; /** From 17c989fe49a736d8a613ac7050341216d838fb69 Mon Sep 17 00:00:00 2001 From: Irena Szukala Date: Thu, 12 Mar 2026 11:05:10 +0100 Subject: [PATCH 2/2] fix: simplify loginUserWithUserAttributes type to UserAttributes 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 --- src/index.tsx | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/index.tsx b/src/index.tsx index 302911d8..074509bd 100644 --- a/src/index.tsx +++ b/src/index.tsx @@ -101,9 +101,7 @@ export type IntercomType = { * Valid identifiers are `userId` and `email` which must be set in the {@link UserAttributes} object. * @param params The {@link UserAttributes} object that contains the user's `email` or `userId`. */ - loginUserWithUserAttributes: ( - params: UserAttributes & ({ email: string } | { userId: string }) - ) => Promise; + loginUserWithUserAttributes: (params: UserAttributes) => Promise; /** * Log a user out of their Intercom session.