Leanplum / Leanplum-Android-SDK

Leanplum's integrated solution delivers meaningful engagement across messaging and the in-app experience.
https://www.leanplum.com
Apache License 2.0
46 stars 40 forks source link

IAM Handlers refactoring #503

Closed hborisoff closed 2 years ago

hborisoff commented 2 years ago
What Where/Who
People Involved @hborisoff

Background

Implements queue mechanism (in Kotlin) for handling and displaying in-app messages and actions. Exposes additional handlers which can be used by developers to decide ad-hoc which messages to be displayed, delayed or discarded. Adds callbacks for display, dismiss, action run.

Implementation

Code is organised in two packages:

Client interface

Client accessible interfaces are located in the com.leanplum.actions package:

Breaking changes !!!

Leanplum.defineAction

The parameter ActionCallback responder was replaced by ActionCallback presentHandler parameter and ActionCallback dismissHandler parameter.

MessageTemplate.java

Interface is used for easier registration of the actions/templates.

Removed methods:

New methods:

Testing steps

Testing of functionality

Throughout the implementation process a lot of functionalities has been tested including and not limited to:

Testing of new interfaces

Known Issues

Opening push notification while other inapp is presented

There is a change that prevents leaking of Dialog objects when switching activities. Read the commit's message for more details and check the following case:

If you have inapp M1 presented, M2 waiting in the queue, and a push P1 comes with payload M3. What will happen on a P1 click is first M1 dismisses, because activity changes (depends on implementation), next M2 is presented, but the M3 from payload is added with higher priority, so M2 is dismissed too and only M3 is presented. If you have a third inapp it will remain in the queue and will present after M3.

Other documentation

iOS's IAM Handlers PR. Internal document about Use Cases.

Is this change backwards-compatible?

Check Breaking changes paragraph for more details.