Skip to content

Commit 50d8091

Browse files
committed
Merge branch 'master' into release/6.0.0
2 parents 0bb6ea8 + d824876 commit 50d8091

File tree

2 files changed

+85
-84
lines changed

2 files changed

+85
-84
lines changed

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

Lines changed: 82 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -27,96 +27,94 @@ import com.leanplum.internal.ActionManager
2727
/**
2828
* Contains configuration methods for the action queue.
2929
*/
30-
class LeanplumActions {
31-
companion object {
32-
/**
33-
* Keep or dismiss in-app message when push notification is opened. If kept, the action from the
34-
* push notification will go into the queue and will present after in-app dismissal, otherwise
35-
* the in-app is dismissed and the push notification's action is presented.
36-
*
37-
* Default value is true.
38-
*
39-
* @param flag If true in-app is dismissed, otherwise push action goes into the queue.
40-
*/
41-
@JvmStatic
42-
fun setDismissOnPushOpened(flag: Boolean) {
43-
ActionManager.getInstance().dismissOnPushOpened = flag
44-
}
45-
46-
/**
47-
* Message queue is paused when app is backgrounded and resumed when app is foregrounded. You
48-
* can change that behaviour if you pass false.
49-
*
50-
* Default value is true.
51-
*/
52-
@JvmStatic
53-
fun setContinueOnActivityResumed(flag: Boolean) {
54-
ActionManager.getInstance().continueOnActivityResumed = flag
55-
}
30+
object LeanplumActions {
31+
/**
32+
* Keep or dismiss in-app message when push notification is opened. If kept, the action from the
33+
* push notification will go into the queue and will present after in-app dismissal, otherwise
34+
* the in-app is dismissed and the push notification's action is presented.
35+
*
36+
* Default value is true.
37+
*
38+
* @param flag If true in-app is dismissed, otherwise push action goes into the queue.
39+
*/
40+
@JvmStatic
41+
fun setDismissOnPushOpened(flag: Boolean) {
42+
ActionManager.getInstance().dismissOnPushOpened = flag
43+
}
5644

57-
/**
58-
* Sets controller instance that will decide the order and priority of messages.
59-
*
60-
* If controller is not set and multiple messages are triggered at once it will execute only the
61-
* first one. This ensures backwards compatibility.
62-
*
63-
* @param controller Instance of the controller class. Pass null if you want to remove your
64-
* instance.
65-
*/
66-
@JvmStatic
67-
fun setMessageDisplayController(controller: MessageDisplayController?) {
68-
ActionManager.getInstance().messageDisplayController = controller
69-
}
45+
/**
46+
* Message queue is paused when app is backgrounded and resumed when app is foregrounded. You
47+
* can change that behaviour if you pass false.
48+
*
49+
* Default value is true.
50+
*/
51+
@JvmStatic
52+
fun setContinueOnActivityResumed(flag: Boolean) {
53+
ActionManager.getInstance().continueOnActivityResumed = flag
54+
}
7055

71-
/**
72-
* Sets a listener instance to be invoked when a message is displayed, dismissed, or clicked.
73-
*
74-
* @param listener Instance of listener class. Pass null if you want remove your instance.
75-
*/
76-
@JvmStatic
77-
fun setMessageDisplayListener(listener: MessageDisplayListener?) {
78-
ActionManager.getInstance().messageDisplayListener = listener
79-
}
56+
/**
57+
* Sets controller instance that will decide the order and priority of messages.
58+
*
59+
* If controller is not set and multiple messages are triggered at once it will execute only the
60+
* first one. This ensures backwards compatibility.
61+
*
62+
* @param controller Instance of the controller class. Pass null if you want to remove your
63+
* instance.
64+
*/
65+
@JvmStatic
66+
fun setMessageDisplayController(controller: MessageDisplayController?) {
67+
ActionManager.getInstance().messageDisplayController = controller
68+
}
8069

81-
/**
82-
* Method will trigger postponed messages when indefinite time was used with
83-
* [MessageDisplayController.shouldDisplayMessage]
84-
*/
85-
@JvmStatic
86-
fun triggerDelayedMessages() {
87-
ActionManager.getInstance().triggerDelayedMessages()
88-
}
70+
/**
71+
* Sets a listener instance to be invoked when a message is displayed, dismissed, or clicked.
72+
*
73+
* @param listener Instance of listener class. Pass null if you want remove your instance.
74+
*/
75+
@JvmStatic
76+
fun setMessageDisplayListener(listener: MessageDisplayListener?) {
77+
ActionManager.getInstance().messageDisplayListener = listener
78+
}
8979

90-
/**
91-
* When queue is paused it will stop executing actions but new actions will continue to be
92-
* added.
93-
*/
94-
@JvmStatic
95-
fun setQueuePaused(paused: Boolean) {
96-
setContinueOnActivityResumed(!paused)
97-
ActionManager.getInstance().isPaused = paused
98-
}
80+
/**
81+
* Method will trigger postponed messages when indefinite time was used with
82+
* [MessageDisplayController.shouldDisplayMessage]
83+
*/
84+
@JvmStatic
85+
fun triggerDelayedMessages() {
86+
ActionManager.getInstance().triggerDelayedMessages()
87+
}
9988

100-
/**
101-
* Returns the paused state of the queue.
102-
* Check [setQueuePaused].
103-
*/
104-
@JvmStatic
105-
fun isQueuePaused() = ActionManager.getInstance().isPaused
89+
/**
90+
* When queue is paused it will stop executing actions but new actions will continue to be
91+
* added.
92+
*/
93+
@JvmStatic
94+
fun setQueuePaused(paused: Boolean) {
95+
setContinueOnActivityResumed(!paused)
96+
ActionManager.getInstance().isPaused = paused
97+
}
10698

107-
/**
108-
* When queue is disabled it will stop executing actions and new actions won't be added.
109-
*/
110-
@JvmStatic
111-
fun setQueueEnabled(enabled: Boolean) {
112-
ActionManager.getInstance().isEnabled = enabled
113-
}
99+
/**
100+
* Returns the paused state of the queue.
101+
* Check [setQueuePaused].
102+
*/
103+
@JvmStatic
104+
fun isQueuePaused() = ActionManager.getInstance().isPaused
114105

115-
/**
116-
* Returns the enabled state of the queue.
117-
* Check [setQueueEnabled]
118-
*/
119-
@JvmStatic
120-
fun isQueueEnabled() = ActionManager.getInstance().isEnabled
106+
/**
107+
* When queue is disabled it will stop executing actions and new actions won't be added.
108+
*/
109+
@JvmStatic
110+
fun setQueueEnabled(enabled: Boolean) {
111+
ActionManager.getInstance().isEnabled = enabled
121112
}
113+
114+
/**
115+
* Returns the enabled state of the queue.
116+
* Check [setQueueEnabled]
117+
*/
118+
@JvmStatic
119+
fun isQueueEnabled() = ActionManager.getInstance().isEnabled
122120
}

AndroidSDKCore/src/main/java/com/leanplum/internal/ActionManager.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -661,6 +661,9 @@ int sessionOccurrencesCount() {
661661
public void setEnabled(boolean value) {
662662
Log.i("[ActionManager] isEnabled: " + value);
663663
enabled = value;
664+
if (enabled) {
665+
ActionManagerExecutionKt.performActions(ActionManager.getInstance());
666+
}
664667
}
665668

666669
/**

0 commit comments

Comments
 (0)