Skip to content

Conversation

@franco-zalamena-iterable
Copy link

@franco-zalamena-iterable franco-zalamena-iterable commented Feb 3, 2026

🔹 Jira Ticket(s) if any

✏️ Description

This fix is meant to be a more straight forward fix for the double callback issue some clients have encountered when autoPushRegistration is set to false.

Root cause:
When autoPushRegistration is false and we call setEmail, no remote call is made to actually update the current user in the iterable app, so we wait for the push registration to be made to consider it completely done.
Because some users were using the callbackHandler within a couroutine, when the registerDeviceToken was called we would wrap the setEmail callback into the registerDeviceToken call, so we could notify when the setEmail flow was actually completed, but that caused the callback to fire twice, and if the coroutine was dependant of a success to continue that would cause the app to crash.

The Solution:
To clear the success handler when it is called on autoPushRegistration = false, so when the user calls for registering the device we won't cause the same success handler to fire twice.
Also some better responses are provided for better understanding of the process and why things are happening this way.

@franco-zalamena-iterable franco-zalamena-iterable force-pushed the SDK-289-fix-double-callback-simple branch from a70950b to 18cab40 Compare February 3, 2026 14:04
Copy link
Member

@Ayyanchira Ayyanchira left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made some comments

Comment on lines +41 to +43
static JSONObject setEmailLocalSuccessResponse = new JSONObject(Map.of("message", "setEmail was completed locally, but still requires the register device call. If possible, use autoPushRegistration."));

static JSONObject setReadLocalSuccessResponse = new JSONObject(Map.of("message", "setRead was completed locally, no remote call was done yet."));
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any reason why these are static?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm I think for it to be retain its value throughout the flow ?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's in order to work as the kotlin object, so we can just call the class without instantiating it and for the class to just be a container of these responses

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this object initialized when the app starts without having called setEmail and inAppRead?
Another point to look at is:
If multiple inapps are getting read, is there a possibility of these handlers to behave differently than expected?

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, the fields are initialized when the app starts.
The handlers are not changing at all, only the json that is getting returned

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.

3 participants