|
16 | 16 | import com.iterable.iterableapi.IterableActionContext; |
17 | 17 | import com.iterable.iterableapi.IterableConfig; |
18 | 18 | import com.iterable.iterableapi.IterableDataRegion; |
| 19 | +import com.iterable.iterableapi.IterableEmbeddedMessage; |
19 | 20 | import com.iterable.iterableapi.IterableInAppCloseAction; |
20 | 21 | import com.iterable.iterableapi.IterableInAppDeleteActionType; |
21 | 22 | import com.iterable.iterableapi.IterableInAppHandler; |
22 | 23 | import com.iterable.iterableapi.IterableInAppLocation; |
23 | 24 | import com.iterable.iterableapi.IterableInAppMessage; |
24 | 25 | import com.iterable.iterableapi.IterableInboxSession; |
25 | 26 | import com.iterable.iterableapi.IterableLogger; |
26 | | -import com.iterable.iterableapi.RNIterableInternal; |
27 | 27 | import com.iterable.iterableapi.RetryPolicy; |
| 28 | +import com.iterable.iterableapi.RNIterableInternal; |
28 | 29 |
|
29 | 30 | import org.json.JSONArray; |
30 | 31 | import org.json.JSONException; |
@@ -137,6 +138,17 @@ static JSONArray serializeInAppMessages(List<IterableInAppMessage> inAppMessages |
137 | 138 | return inAppMessagesJson; |
138 | 139 | } |
139 | 140 |
|
| 141 | + static JSONArray serializeEmbeddedMessages(List<IterableEmbeddedMessage> embeddedMessages) { |
| 142 | + JSONArray embeddedMessagesJson = new JSONArray(); |
| 143 | + if (embeddedMessages != null) { |
| 144 | + for (IterableEmbeddedMessage message : embeddedMessages) { |
| 145 | + JSONObject messageJson = IterableEmbeddedMessage.Companion.toJSONObject(message); |
| 146 | + embeddedMessagesJson.put(messageJson); |
| 147 | + } |
| 148 | + } |
| 149 | + return embeddedMessagesJson; |
| 150 | + } |
| 151 | + |
140 | 152 | static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableContextMap) { |
141 | 153 | try { |
142 | 154 | JSONObject iterableContextJSON = convertMapToJson(iterableContextMap); |
@@ -218,6 +230,10 @@ static IterableConfig.Builder getConfigFromReadableMap(ReadableMap iterableConte |
218 | 230 | configBuilder.setDataRegion(iterableDataRegion); |
219 | 231 | } |
220 | 232 |
|
| 233 | + if (iterableContextJSON.has("enableEmbeddedMessaging")) { |
| 234 | + configBuilder.setEnableEmbeddedMessaging(iterableContextJSON.optBoolean("enableEmbeddedMessaging")); |
| 235 | + } |
| 236 | + |
221 | 237 | if (iterableContextJSON.has("retryPolicy")) { |
222 | 238 | JSONObject retryPolicyJson = iterableContextJSON.getJSONObject("retryPolicy"); |
223 | 239 | int maxRetry = retryPolicyJson.getInt("maxRetry"); |
|
0 commit comments