Skip to content

fix: treat time since last in-app as unbounded when no in-app was dismissed - #2814

Open
RaphaelFakhri wants to merge 1 commit into
OneSignal:mainfrom
RaphaelFakhri:fix/time-since-last-iam-default
Open

RaphaelFakhri wants to merge 1 commit into
OneSignal:mainfrom
RaphaelFakhri:fix/time-since-last-iam-default

Conversation

@RaphaelFakhri

Copy link
Copy Markdown

Description

One Line Summary

Fix "Time since last in-app message" triggers that wait instead of firing when no in-app message has been dismissed yet.

Details

Motivation

Fixes #1602. When lastTimeInAppDismissed is null, DynamicTriggerController falls back to DEFAULT_LAST_IN_APP_TIME_AGO, which is meant to mean "a very long time ago". The constant is 999999, but the value is compared against intervals in milliseconds, so it only represents about 16.7 minutes.

As a result, a trigger such as "time since last in-app message greater than 3600 seconds" does not fire for a user who has never dismissed an in-app message. Instead, the SDK schedules a timer for the remaining 43 minutes or so, and the message shows late or not at all if the session ends first. Any threshold above about 16.7 minutes is affected.

The fallback is now Long.MAX_VALUE, so a user who has never dismissed an in-app message always satisfies a "greater than" threshold, and never satisfies a "less than" threshold.

Scope

Only the fallback used when no in-app message has been dismissed changes. Triggers evaluated after a dismissal still use the persisted dismissal time, and session-time triggers are unchanged.

Testing

Unit testing

Added DynamicTriggerControllerTests:

  • A "time since last in-app greater than 3600 seconds" trigger fires when no in-app message has been dismissed. This test fails before the fix.
  • The same trigger does not fire one minute after a dismissal.

Manual testing

Not tested on a device. The change only affects the trigger evaluation covered by the unit tests.

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

@RaphaelFakhri
RaphaelFakhri requested a review from a team as a code owner October 25, 2026 07:40
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.

Time since last In-App Message trigger, not working when time is greater than DEFAULT_LAST_IN_APP_TIME_AGO

1 participant