1 package com.netease.nimlib.sdk.msg.model;
3 import android.text.TextUtils;
10 import org.json.JSONArray;
11 import org.json.JSONException;
12 import org.json.JSONObject;
14 import java.io.Serializable;
15 import java.util.ArrayList;
23 private static final String TAG =
"QuickCommentOptionWrapper";
25 private ArrayList<QuickCommentOption> quickCommentList;
26 private boolean modify;
33 this.quickCommentList = quickCommentList;
38 boolean modify =
property.getInteger(ITalkExtensionService.QuickCommentResponseTag.modify) == 1;
39 long time =
property.getLong(ITalkExtensionService.QuickCommentResponseTag.timestamp);
40 ArrayList<QuickCommentOption> quickCommentList = getCommentListFromJsonStr(property.get(ITalkExtensionService.QuickCommentResponseTag.detail));
44 private static ArrayList<QuickCommentOption> getCommentListFromJsonStr(String jsonStr) {
45 if (TextUtils.isEmpty(jsonStr)) {
46 return new ArrayList<>(0);
50 final JSONArray array =
new JSONArray(jsonStr);
51 final int len = array.length();
52 ArrayList<QuickCommentOption> result =
new ArrayList<>(len);
53 for (i = 0; i < len; ++i) {
54 JSONObject obj = (JSONObject) array.get(i);
59 }
catch (JSONException e) {
61 NimLog.i(TAG,
"parse json string err when " + i);
62 return new ArrayList<>(0);
72 private static MessageKey getMessageKey(Property property) {
74 String fromAccount =
property.get(ITalkExtensionService.QuickCommentResponseTag.fromAccount);
75 String toAccount =
property.get(ITalkExtensionService.QuickCommentResponseTag.toAccount);
76 long time =
property.getLong(ITalkExtensionService.QuickCommentResponseTag.time);
77 long serverId =
property.getLong(ITalkExtensionService.QuickCommentResponseTag.msgid_server);
78 String uuid =
property.get(ITalkExtensionService.QuickCommentResponseTag.msgid_client);
79 return new MessageKey(sessionType, fromAccount, toAccount, time, serverId, uuid);
87 return quickCommentList;
static SessionTypeEnum typeOfValue(int value)
消息的关键信息,通过这些信息可以从服务端查询到该消息的完整部分