Skip to content

Commit f409462

Browse files
committed
Use "messageId" in toJSONObject
- Update JSON stringifier to use key of "messageId" instead of "id" - "id" is expected instead of "messageId" when parsing JSON from the backend, so it is used in the constructor for `OSInAppMessageInternal`
1 parent 3c59786 commit f409462

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

OneSignalSDK/onesignal/src/main/java/com/onesignal/OSInAppMessageInternal.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@
1717

1818
class OSInAppMessageInternal extends OSInAppMessage {
1919

20-
private static final String IAM_ID = "id";
20+
// "id" is expected instead of "messageId" when parsing JSON from the backend
21+
private static final String ID = "id";
22+
private static final String IAM_ID = "messageId";
2123
private static final String IAM_VARIANTS = "variants";
2224
private static final String IAM_TRIGGERS = "triggers";
2325
private static final String IAM_REDISPLAY_STATS = "redisplay";
@@ -74,7 +76,8 @@ class OSInAppMessageInternal extends OSInAppMessage {
7476

7577
OSInAppMessageInternal(JSONObject json) throws JSONException {
7678
// initialize simple root properties
77-
super(json.getString(IAM_ID));
79+
// "id" is expected instead of "messageId" when parsing JSON from the backend
80+
super(json.getString(ID));
7881
this.variants = parseVariants(json.getJSONObject(IAM_VARIANTS));
7982
this.triggers = parseTriggerJson(json.getJSONArray(IAM_TRIGGERS));
8083
this.clickedClickIds = new HashSet<>();

0 commit comments

Comments
 (0)