From bd93494ce21b3ef5f34b24d967032e024cb4379d Mon Sep 17 00:00:00 2001 From: Evan Greer Date: Tue, 21 Nov 2023 14:21:13 -0700 Subject: [PATCH 1/3] adds custom actions to handleEmbeddedClick --- .../iterableapi/IterableEmbeddedManager.kt | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt index 4c43a35c9..b0eae903c 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt @@ -123,7 +123,31 @@ public class IterableEmbeddedManager : IterableActivityMonitor.AppStateCallback } fun handleEmbeddedClick(message: IterableEmbeddedMessage, buttonIdentifier: String?, clickedUrl: String?) { - IterableActionRunner.executeAction(context, IterableAction.actionOpenUrl(clickedUrl), IterableActionSource.EMBEDDED) + if ((clickedUrl != null) && clickedUrl.toString().isNotEmpty()) { + if (clickedUrl.startsWith(IterableConstants.URL_SCHEME_ACTION)) { + // This is an action:// URL, pass that to the custom action handler + val actionName: String = clickedUrl.replace(IterableConstants.URL_SCHEME_ACTION, "") + IterableActionRunner.executeAction( + context, + IterableAction.actionCustomAction(actionName), + IterableActionSource.EMBEDDED + ) + } else if (clickedUrl.startsWith(IterableConstants.URL_SCHEME_ITBL)) { + // Handle itbl:// URLs, pass that to the custom action handler for compatibility + val actionName: String = clickedUrl.replace(IterableConstants.URL_SCHEME_ITBL, "") + IterableActionRunner.executeAction( + context, + IterableAction.actionCustomAction(actionName), + IterableActionSource.EMBEDDED + ) + } else { + IterableActionRunner.executeAction( + context, + IterableAction.actionOpenUrl(clickedUrl), + IterableActionSource.EMBEDDED + ) + } + } } private fun broadcastSubscriptionInactive() { From 233a01819f39aecfa50d40a22dd65e724392e27a Mon Sep 17 00:00:00 2001 From: Evan Greer Date: Tue, 28 Nov 2023 14:24:55 -0700 Subject: [PATCH 2/3] minor updates --- .../java/com/iterable/iterableapi/IterableEmbeddedManager.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt index b0eae903c..66f4c9cba 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt @@ -127,6 +127,7 @@ public class IterableEmbeddedManager : IterableActivityMonitor.AppStateCallback if (clickedUrl.startsWith(IterableConstants.URL_SCHEME_ACTION)) { // This is an action:// URL, pass that to the custom action handler val actionName: String = clickedUrl.replace(IterableConstants.URL_SCHEME_ACTION, "") + IterableLogger.d("IterableEmbeddedManager", "ACTION NAME: " + actionName) IterableActionRunner.executeAction( context, IterableAction.actionCustomAction(actionName), From 9d6134dfb4838c3bdfe3c204eb7ae0ab6f38cd21 Mon Sep 17 00:00:00 2001 From: Evan Greer Date: Mon, 4 Dec 2023 16:42:07 -0700 Subject: [PATCH 3/3] minor cleanup --- .../java/com/iterable/iterableapi/IterableEmbeddedManager.kt | 1 - 1 file changed, 1 deletion(-) diff --git a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt index 66f4c9cba..b0eae903c 100644 --- a/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt +++ b/iterableapi/src/main/java/com/iterable/iterableapi/IterableEmbeddedManager.kt @@ -127,7 +127,6 @@ public class IterableEmbeddedManager : IterableActivityMonitor.AppStateCallback if (clickedUrl.startsWith(IterableConstants.URL_SCHEME_ACTION)) { // This is an action:// URL, pass that to the custom action handler val actionName: String = clickedUrl.replace(IterableConstants.URL_SCHEME_ACTION, "") - IterableLogger.d("IterableEmbeddedManager", "ACTION NAME: " + actionName) IterableActionRunner.executeAction( context, IterableAction.actionCustomAction(actionName),