Skip to content

Conversation

@nan-li
Copy link
Contributor

@nan-li nan-li commented Jan 20, 2026

Description

One Line Summary

Display IAMs with triggers added before first fetch on cold start.

Details

On subsequent cold starts, if triggers were added very early in the app lifecycle (before the first IAM fetch completed), in-app messages matching those triggers would not display even though they should have been eligible for redisplay.

Root cause: When the trigger is added, evaluateRedisplayedInAppMessages was called when the messages were empty, so message.isTriggerChanged was never set for messages that arrived later from the server.

Solution: Track trigger keys added before the first fetch completes in earlySessionTriggers, then apply isTriggerChanged to matching redisplay messages when they arrive from the server. This ensures the redisplay logic correctly identifies that triggers have changed and clears the message from seenInAppMessages.

Motivation

Provide feature that is requested

Scope

This only affects cold starts (process restarts) and does not impact warm starts from backgrounding, where existing redisplay behavior is preserved.

Testing

Unit testing

WIP

Manual testing

Tested on iOS 18.5 simulator
Add trigger immediately after initialization, and confirm the IAM now displays after the changes in this PR.

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
  • 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.
  • I have reviewed this PR myself, ensuring it meets each checklist item

This change is Reviewable

- Addresses issue where in-app messages wouldn't display on cold starts if their triggers were added very early (before IAM fetch completed).
- Tracks triggers added before first fetch completes, then applies the isTriggerChanged flag to matching messages when they are received from the server, ensuring redisplay logic works correctly.
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