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

Add handler for runActionNamed #460

Closed hborisoff closed 3 years ago

hborisoff commented 3 years ago
What Where/Who
JIRA Issue SDK-455
People Involved @hborisoff

This change enables callback to be invoked when in-app message actions are run. For example - Accept action, Select button 1 action.

Added Dismiss action to be run for some of the in-app templates, where appropriate.

Example usage:

Leanplum.onAction("Center Popup", new ActionCallback() {
    @Override
    public boolean onResponse(ActionContext context) {
        context.setActionNamedHandler(new ActionCallback() {
            @Override
            public boolean onResponse(ActionContext context) {
                String actionName = context.actionName(); // "Accept action"
                String parentActionName = context.getParentContext().actionName(); // "Center Popup"
                return true;
            }
        });
        return true;
    }
});