Skip to content

Conversation

jennantilla
Copy link
Contributor

@jennantilla jennantilla commented Sep 11, 2024

Description

One Line Summary

Pausing IAMs dismisses any currently showing IAM

Details

Detects if there is currently an IAM being displayed when paused is set to true. If so we dismiss the IAM.

Motivation

Add the ability to programmatically close an IAM. This could be used in response to the IAM click listener, or some other event happening in the application.

Scope

In-App Messages

Testing

Manual testing

Tested pausing IAM from the IAM Lifecycle Listener onDidDisplay event. IAM is dismissed, remaining lifecycle callback listeners fire, and queued IAMs don't show.

Tested on Android Studio 2023.3 with a fresh install of the OneSignal example app on a Pixel 8 with Android 14.

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

- Updated the `setPaused` method to dismiss currently-displaying IAM when `paused` is true
- Ensure messages are evaluated and displayed when `paused` is set to false.
@jennantilla jennantilla requested a review from emawby September 11, 2024 20:03
Copy link
Contributor

@emawby emawby left a comment

Choose a reason for hiding this comment

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

Did you test by pausing IAMs in the click handler as well?

- Simplified thread handling with Kotlin coroutines to ensure dismissal code always runs on the main thread
@jennantilla jennantilla requested a review from emawby September 12, 2024 19:25
@jennantilla jennantilla merged commit 146c4c9 into main Sep 13, 2024
2 checks passed
@jennantilla jennantilla deleted the feat/close_IAM_programatically branch September 13, 2024 21:52
@jinliu9508 jinliu9508 mentioned this pull request Sep 27, 2024
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