Skip to content

Fix: IAM not shown when calling login immediately after init #2287

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 26, 2025

Conversation

jinliu9508
Copy link
Contributor

@jinliu9508 jinliu9508 commented Apr 25, 2025

Description

One Line Summary

Fix InAppMessagesManager so it now adds a IAM fetch condition in the event of user change instead of start(), to prevent IAM fetch conditions being created with a local onesignal ID.

Details

Motivation

Fix the issue when IAM is not showing on fresh install if Login is called immediately after initWithContext. This is caused by InAppMessagesManager creating IAM fetch conditions with local OneSignalID and not recognizing an updated ID to resolve. The PR adds a user change handler to add the IAM fetch condition in the event of retrieving a new OneSignalID.

Scope

Every time a OneSignalID is changed from a local ID to a backend ID, a IAM fetch condition will be created to attempt fetching IAMs.

Testing

Manual testing

Issue reproducible by a fresh install that is calling Login immediately after initWithContext. We could observe that IAM does not show on the first startup.

After the fix, IAM shows successfully while the ryw rule stays effective.

Affected code checklist

  • Notifications
    • Display
    • Open
    • Push Processing
    • Confirm Deliveries
  • Outcomes
  • Sessions
  • In-App Messaging
  • REST API requests
  • Public API changes

Checklist

Overview

  • I have filled out all REQUIRED sections above
  • PR does one thing
    • If it is hard to explain how any codes changes are related to each other then it most likely needs to be more than one PR
  • Any Public API changes are explained in the PR details and conform to existing APIs

Testing

  • I have included test coverage for these changes, or explained why they are not needed
  • All automated tests pass, or I explained why that is not possible
  • I have personally tested this on my device, or explained why that is not possible

Final pass

  • Code is as readable as possible.
    • Simplify with less code, followed by splitting up code into well named functions and variables, followed by adding comments to the code.
  • I have reviewed this PR myself, ensuring it meets each checklist item
    • WIP (Work In Progress) is ok, but explain what is still in progress and what you would like feedback on. Start the PR title with "WIP" to indicate this.

This change is Reviewable

@jinliu9508 jinliu9508 force-pushed the iam-not-show-fresh-install branch from c38765f to 181694b Compare April 25, 2025 22:59
Copy link
Member

@jkasten2 jkasten2 left a comment

Choose a reason for hiding this comment

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

You noted in the "Manual testing" section of the PR you tested "... a fresh install that is calling Login immediately after initWithContext.". Can you test the following scenarios as well?

  • Fresh install without calling login
  • Restarting the app after login
  • Restarting the app (login never called).

@jinliu9508
Copy link
Contributor Author

You noted in the "Manual testing" section of the PR you tested "... a fresh install that is calling Login immediately after initWithContext.". Can you test the following scenarios as well?

  • Fresh install without calling login
  • Restarting the app after login
  • Restarting the app (login never called).

Good point. Here the the test result:

  • Fresh install without calling login: pass
  • Restarting the app login never called: pass
  • Restarting the app after login: pass

Additionally, I also test with IAM with triggers:

  • Fresh install without calling login, then add trigger: pass
  • Restarting the app login never called, then add trigger: pass
  • Restarting the app after login, call the segment specific trigger: pass

@jinliu9508 jinliu9508 merged commit 5b0d145 into main Apr 26, 2025
2 checks passed
@jinliu9508 jinliu9508 deleted the iam-not-show-fresh-install branch April 26, 2025 00:21
@jinliu9508 jinliu9508 mentioned this pull request Apr 26, 2025
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.

2 participants