Skip to content

Commit 4746edf

Browse files
committed
fix(inbox): Fix for parsing inbox data field - LP-6235.
1 parent 3a0b3d4 commit 4746edf

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

AndroidSDK/src/com/leanplum/LeanplumInboxMessage.java

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626

2727
import com.leanplum.internal.CollectionUtil;
2828
import com.leanplum.internal.Constants;
29+
import com.leanplum.internal.JsonConverter;
2930
import com.leanplum.internal.Log;
3031
import com.leanplum.internal.Request;
3132
import com.leanplum.internal.Util;
@@ -110,11 +111,10 @@ public Uri getImageUrl() {
110111
public JSONObject getData() {
111112
JSONObject object = null;
112113
try {
113-
String dataString = getContext().stringNamed(Constants.Keys.DATA);
114-
if (!TextUtils.isEmpty(dataString)) {
115-
object = new JSONObject(dataString);
116-
}
117-
} catch (Exception e) {
114+
Map<String, ?> mapData =
115+
CollectionUtil.uncheckedCast(getContext().objectNamed(Constants.Keys.DATA));
116+
object = JsonConverter.mapToJsonObject(mapData);
117+
} catch (Throwable t) {
118118
Log.w("Unable to parse JSONObject for Data field of inbox message.");
119119
}
120120
return object;
@@ -127,7 +127,6 @@ public String getMessageId() {
127127
return messageId;
128128
}
129129

130-
131130
/**
132131
* Returns the title of the inbox message.
133132
*/
@@ -293,5 +292,4 @@ private Map<String, Object> actionArgs() {
293292
private void setIsRead(boolean isRead) {
294293
this.isRead = isRead;
295294
}
296-
297295
}

0 commit comments

Comments
 (0)