aboutsummaryrefslogtreecommitdiff
path: root/src/test/java/com/juick/json/MessageSerializer.java
diff options
context:
space:
mode:
authorGravatar Vitaly Takmazov2016-11-30 16:49:11 +0300
committerGravatar Vitaly Takmazov2016-11-30 16:49:11 +0300
commit1a2830588131173d8fbfeb1fe03c466b4cf30e46 (patch)
tree53889640b356f22e6620acffed0bda1e56babcf6 /src/test/java/com/juick/json/MessageSerializer.java
parentf5fd9c7bea380eb4c0c2d58f2167ad3f07c45c33 (diff)
juick-core: fix attachment serialization
Diffstat (limited to 'src/test/java/com/juick/json/MessageSerializer.java')
-rw-r--r--src/test/java/com/juick/json/MessageSerializer.java13
1 files changed, 10 insertions, 3 deletions
diff --git a/src/test/java/com/juick/json/MessageSerializer.java b/src/test/java/com/juick/json/MessageSerializer.java
index ebc3b0b0..38596a1a 100644
--- a/src/test/java/com/juick/json/MessageSerializer.java
+++ b/src/test/java/com/juick/json/MessageSerializer.java
@@ -18,6 +18,7 @@
package com.juick.json;
import com.juick.Message;
+import com.juick.Photo;
import com.juick.Tag;
import org.json.JSONArray;
import org.json.JSONException;
@@ -79,7 +80,12 @@ public class MessageSerializer extends JSONSerializer<Message> {
}
if (json.has("photo")) {
- jmsg.Photo = json.getJSONObject("photo").getString("small");
+ JSONObject obj = json.getJSONObject("photo");
+ Photo photo = new Photo();
+ photo.setSmall(obj.getString("small"));
+ photo.setMedium(obj.getString("medium"));
+ photo.setThumbnail(obj.getString("thumbnail"));
+ jmsg.setPhoto(photo);
}
return jmsg;
@@ -123,8 +129,9 @@ public class MessageSerializer extends JSONSerializer<Message> {
if (msg.Place != null) {
json.put("place", placeSerializer.serialize(msg.Place));
}
- if (msg.AttachmentType != null) {
- String fname = msg.getMid() + (msg.getRid() > 0 ? "-" + msg.getRid() : "") + "." + msg.AttachmentType;
+ if (msg.getAttachmentType() != null) {
+ json.put("attach", msg.getAttachmentType());
+ String fname = msg.getMid() + (msg.getRid() > 0 ? "-" + msg.getRid() : "") + "." + msg.getAttachmentType();
JSONObject photo = new JSONObject();
String protocol = getUriScheme() == URIScheme.Plain ? "http:" : "https:";
photo.put("thumbnail", protocol + "//i.juick.com/ps/" + fname);