Fix: Don't retry IAM display if 410 is received from backend #2158
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
One Line Summary
Don't retry IAM display if 410 is received from backend
Details
Motivation
In instances where an IAM is disabled mid-session, a 410 is received and is caught in a retrying loop. This change will prevent the retry and just not display the IAM, since it just become disabled.
Scope
Changes to
InAppMessagesManager
only.Since this change involves changing the
messages
list, synchronization was added tomakeRedisplayMessagesAvailableWithTriggers
andattemptToShowInAppMessage
to prevent concurrent modification issues.evaluateInAppMessages
was further updated to collect messages for display inside a synchronized block and process them outside to avoid suspension points within critical sections.Testing
Manual testing
Forced reproduction by setting breakpoint right before IAM is set to display, pausing the IAM from the dashboard, then resuming app flow. A 410 will result.
After updating the code, tested on an Android 14 emulator to see that app resumes normally after IAM is paused in the dashboard. Subsequent 410s are not received and app resumes as expected.
Affected code checklist
Checklist
Overview
Testing
Final pass
This change is