Skip to content

Commit 4ffee10

Browse files
committed
Added consume logic to the spawn in app call
1 parent 1dbf7a8 commit 4ffee10

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

iterableapi/src/main/java/com/iterable/iterableapi/IterableApi.java

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -544,6 +544,7 @@ public void execute(String payload) {
544544
String messageId = dialogOptions.optString(IterableConstants.KEY_MESSAGE_ID);
545545

546546
IterableApi.sharedInstance.trackInAppOpen(campaignId, templateId, messageId);
547+
IterableApi.sharedInstance.inAppConsume(messageId);
547548
IterableNotificationData trackParams = new IterableNotificationData(campaignId, templateId, messageId);
548549
IterableInAppManager.showNotification(context, message, trackParams, clickCallback);
549550

@@ -616,6 +617,24 @@ public void trackInAppClick(int campaignId, int templateId, String messageId, in
616617
sendPostRequest(IterableConstants.ENDPOINT_TRACK_INAPP_CLICK, requestJSON);
617618
}
618619

620+
/**
621+
* Consumes an InApp message.
622+
* @param messageId
623+
*/
624+
public void inAppConsume(String messageId) {
625+
JSONObject requestJSON = new JSONObject();
626+
627+
try {
628+
addEmailOrUserIdToJson(requestJSON);
629+
requestJSON.put(IterableConstants.KEY_MESSAGE_ID, messageId);
630+
}
631+
catch (JSONException e) {
632+
e.printStackTrace();
633+
}
634+
635+
sendPostRequest(IterableConstants.ENDPOINT_INAPP_CONSUME, requestJSON);
636+
}
637+
619638
//---------------------------------------------------------------------------------------
620639
//endregion
621640

iterableapi/src/main/java/com/iterable/iterableapi/IterableConstants.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public final class IterableConstants {
3333
//API Endpoint Key Constants
3434
public static final String ENDPOINT_DISABLE_DEVICE = "users/disableDevice";
3535
public static final String ENDPOINT_GET_INAPP_MESSAGES = "inApp/getMessages";
36+
public static final String ENDPOINT_INAPP_CONSUME = "events/inAppConsume";
3637
public static final String ENDPOINT_PUSH_TARGET = "push/target";
3738
public static final String ENDPOINT_REGISTER_DEVICE_TOKEN = "users/registerDeviceToken";
3839
public static final String ENDPOINT_TRACK = "events/track";

0 commit comments

Comments
 (0)