Skip to content

Commit

Permalink
Use SDK 7.1.2-beta1 and async handlers flag in UI
Browse files Browse the repository at this point in the history
  • Loading branch information
hborisoff committed Apr 19, 2023
1 parent b257222 commit 32d9a73
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 4 deletions.
2 changes: 1 addition & 1 deletion RondoApp/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ apply plugin: 'realm-android'
apply plugin: 'com.google.gms.google-services'
apply plugin: 'com.huawei.agconnect'

def LEANPLUM_SDK_VERSION = System.getenv("LEANPLUM_SDK_VERSION") ?: "7.1.1"
def LEANPLUM_SDK_VERSION = System.getenv("LEANPLUM_SDK_VERSION") ?: "7.1.2-beta1"
def LEANPLUM_CT_SDK_VERSION = System.getenv("LEANPLUM_CT_SDK_VERSION") ?: "4.7.4"

ext {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected void onCreate(Bundle savedInstanceState) {

final ListView listview = findViewById(R.id.listview);
String[] values = new String[] { "alert", "centerPopup", "confirm",
"interstitial", "richInterstitial", "webInterstitial", "banner",
"interstitial", "richInterstitial", "imageInterstitial", "webInterstitial", "banner",
LOG_IMPRESSIONS, LOG_TRIGGERS};

final ArrayList<String> list = new ArrayList<String>();
Expand Down
6 changes: 6 additions & 0 deletions RondoApp/src/main/java/com/leanplum/rondo/QueueActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ class QueueActivity : AppCompatActivity() {
}

private fun initCheckBoxes() {
asyncHandlersView().isChecked = LeanplumActions.useWorkerThreadForDecisionHandlers
pauseQueueView().isChecked = LeanplumActions.isQueuePaused()
disableQueueView().isChecked = !LeanplumActions.isQueueEnabled()
dismissOnPushOpenedView().isChecked = ActionManager.getInstance().dismissOnPushOpened
Expand Down Expand Up @@ -124,6 +125,10 @@ class QueueActivity : AppCompatActivity() {
val checked: Boolean = (view as CompoundButton).isChecked

when (view) {
asyncHandlersView() -> {
LeanplumActions.useWorkerThreadForDecisionHandlers = checked
initCheckBoxes()
}
pauseQueueView() -> {
LeanplumActions.setQueuePaused(checked)
initCheckBoxes()
Expand All @@ -148,6 +153,7 @@ class QueueActivity : AppCompatActivity() {
}
}

fun asyncHandlersView() = findViewById<CheckBox>(R.id.asyncHandlers)
fun pauseQueueView() = findViewById<CheckBox>(R.id.pauseQueue)
fun disableQueueView() = findViewById<CheckBox>(R.id.disableQueue)
fun dismissOnPushOpenedView() = findViewById<CheckBox>(R.id.dismissOnPushOpened)
Expand Down
13 changes: 11 additions & 2 deletions RondoApp/src/main/java/com/leanplum/rondo/QueueActivityModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@ import com.leanplum.actions.MessageDisplayChoice
import com.leanplum.actions.MessageDisplayController
import com.leanplum.actions.MessageDisplayListener
import com.leanplum.actions.internal.ActionsTrigger
import com.leanplum.actions.internal.triggerDelayedMessages
import com.leanplum.internal.ActionManager
import com.leanplum.internal.Log
import com.leanplum.internal.Util
import org.json.JSONArray
import org.json.JSONObject

Expand All @@ -19,7 +20,10 @@ object MessageDisplayControllerObject : MessageDisplayController {
var displayChoice: MessageDisplayChoice? = null
var prioritizationChoice: PrioritizationType? = null

override fun shouldDisplayMessage(action: ActionContext): MessageDisplayChoice? = displayChoice
override fun shouldDisplayMessage(action: ActionContext): MessageDisplayChoice? =
displayChoice.also {
Log.d("ShouldDisplayMessage running on main thread: ${Util.isMainThread()}")
}

override fun prioritizeMessages(
actions: List<ActionContext>,
Expand All @@ -28,6 +32,8 @@ object MessageDisplayControllerObject : MessageDisplayController {
PrioritizationType.ONLY_FIRST -> listOf(actions.first())
PrioritizationType.ALL_REVERSED -> actions.reversed()
else -> actions
}.also {
Log.d("MessagePrioritization running on main thread: ${Util.isMainThread()}")
}
}

Expand All @@ -41,18 +47,21 @@ object MessageDisplayListenerObject : MessageDisplayListener {
if (trackDisplayEvents) {
trackedEventsJson.addAction(action, "onMessageDisplayed")
}
Log.d("onMessageDisplayed running on main thread: ${Util.isMainThread()}")
}

override fun onMessageDismissed(action: ActionContext) {
if (trackDismissEvents) {
trackedEventsJson.addAction(action, "onMessageDismissed")
}
Log.d("onMessageDismissed running on main thread: ${Util.isMainThread()}")
}

override fun onActionExecuted(name: String, action: ActionContext) {
if (trackExecuteEvents) {
trackedEventsJson.addAction(action, "onActionExecuted")
}
Log.d("onActionExecuted running on main thread: ${Util.isMainThread()}")
}
}

Expand Down
6 changes: 6 additions & 0 deletions RondoApp/src/main/res/layout/activity_queue.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@
android:layout_height="wrap_content"
android:orientation="vertical">

<CheckBox
android:id="@+id/asyncHandlers"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:onClick="onCheckboxClicked"
android:text="Enable Async Handlers" />
<CheckBox
android:id="@+id/pauseQueue"
android:layout_width="match_parent"
Expand Down

0 comments on commit 32d9a73

Please sign in to comment.