Skip to content

Commit ece76d7

Browse files
authored
Fix IAM Handler dismiss functionality (#505)
1 parent d478fe8 commit ece76d7

File tree

6 files changed

+18
-14
lines changed

6 files changed

+18
-14
lines changed

AndroidSDKCore/src/main/java/com/leanplum/actions/LeanplumActions.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,8 @@ class LeanplumActions {
9393
*/
9494
@JvmStatic
9595
fun setQueuePaused(paused: Boolean) {
96-
ActionManager.getInstance().isPaused = paused
9796
setContinueOnActivityResumed(!paused)
97+
ActionManager.getInstance().isPaused = paused
9898
}
9999

100100
/**

AndroidSDKCore/src/main/java/com/leanplum/actions/internal/ActionManagerExecution.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ fun ActionManager.dismissCurrentAction() {
100100

101101
@UiThread
102102
private fun ActionManager.performActionsImpl() {
103-
if (isPaused) return
103+
if (isPaused || !isEnabled) return
104104

105105
// do not continue if we have action running
106106
if (currentAction != null) {

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/actions/CenterPopupMessage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public boolean present(@NonNull ActionContext context) {
5757

5858
CenterPopupOptions options = new CenterPopupOptions(context);
5959
popup = new CenterPopupController(activity, options);
60-
popup.setOnDismissListener(listener -> popup = null);
60+
popup.setOnDismissListener(listener -> {
61+
popup = null;
62+
context.actionDismissed();
63+
});
6164
popup.show();
6265

6366
return true;
@@ -66,9 +69,7 @@ public boolean present(@NonNull ActionContext context) {
6669
@Override
6770
public boolean dismiss(@NonNull ActionContext context) {
6871
if (popup != null) {
69-
popup.setOnDismissListener(listener -> context.actionDismissed());
7072
popup.dismiss();
71-
popup = null;
7273
}
7374
return true;
7475
}

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/actions/InterstitialMessage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public boolean present(@NonNull ActionContext context) {
5757

5858
InterstitialOptions options = new InterstitialOptions(context);
5959
interstitial = new InterstitialController(activity, options);
60-
interstitial.setOnDismissListener(listener -> interstitial = null);
60+
interstitial.setOnDismissListener(listener -> {
61+
interstitial = null;
62+
context.actionDismissed();
63+
});
6164
interstitial.show();
6265

6366
return true;
@@ -66,9 +69,7 @@ public boolean present(@NonNull ActionContext context) {
6669
@Override
6770
public boolean dismiss(@NonNull ActionContext context) {
6871
if (interstitial != null) {
69-
interstitial.setOnDismissListener(listener -> context.actionDismissed());
7072
interstitial.dismiss();
71-
interstitial = null;
7273
}
7374
return true;
7475
}

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/actions/RichHtmlMessage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,10 @@ public boolean present(@NonNull ActionContext context) {
6464

6565
// Message is shown after html is rendered. Check handleOpenEvent(url) method.
6666
richHtml = new RichHtmlController(activity, richOptions);
67-
richHtml.setOnDismissListener(listener -> richHtml = null);
67+
richHtml.setOnDismissListener(listener -> {
68+
richHtml = null;
69+
context.actionDismissed();
70+
});
6871
return true;
6972

7073
} catch (Throwable t) {
@@ -76,9 +79,7 @@ public boolean present(@NonNull ActionContext context) {
7679
@Override
7780
public boolean dismiss(@NonNull ActionContext context) {
7881
if (richHtml != null) {
79-
richHtml.setOnDismissListener(listener -> context.actionDismissed());
8082
richHtml.dismiss();
81-
richHtml = null;
8283
}
8384
return true;
8485
}

AndroidSDKCore/src/main/java/com/leanplum/messagetemplates/actions/WebInterstitialMessage.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,10 @@ public boolean present(@NonNull ActionContext context) {
5757

5858
WebInterstitialOptions options = new WebInterstitialOptions(context);
5959
webInterstitial = new WebInterstitialController(activity, options);
60-
webInterstitial.setOnDismissListener(listener -> webInterstitial = null);
60+
webInterstitial.setOnDismissListener(listener -> {
61+
webInterstitial = null;
62+
context.actionDismissed();
63+
});
6164
webInterstitial.show();
6265

6366
return true;
@@ -66,9 +69,7 @@ public boolean present(@NonNull ActionContext context) {
6669
@Override
6770
public boolean dismiss(@NonNull ActionContext context) {
6871
if (webInterstitial != null) {
69-
webInterstitial.setOnDismissListener(listener -> context.actionDismissed());
7072
webInterstitial.dismiss();
71-
webInterstitial = null;
7273
}
7374
return true;
7475
}

0 commit comments

Comments
 (0)